Community Spring Cleaning week is here! Join your fellow Maveryx in digging through your old posts and marking comments on them as solved. Learn more here!

Alteryx Designer Desktop Discussions

Find answers, ask questions, and share expertise about Alteryx Designer Desktop and Intelligence Suite.
SOLVED

Mix Panel API

felixcaspari
7 - Meteor

Alteryx Community,

 

I am trying to access mixpanel data via the provided API.

 

I have been using the "Text Input" and "Download" tool. But haven't had success.

 

Even testing the provided shell scenario (https://developer.mixpanel.com/docs/data-export-api) isn't providing any output. I received the "Error transferring data: Couldn't resolve host name" error message.

 

Here is the statement i am converting-

 

curl https://mixpanel.com/api/2.0/segmentation/ \
    #Replace API_SECRET with your project's API secret
    -u API_SECRET: \
    -d from_date="2016-02-11" \
    -d to_date="2016-02-11" \
    -d event="Viewed Page"

 

https://api_secret@mixpanel.com/api/2.0/segmentation?from_date=2016-02-11&to_date=2016-02-11&event=Viewed Page

 

I am replacing the "api_secret" with the actual code that was provided. In addition, I am changing the dates to 2019-10-01 to 2019-10-11.

 

When I paste the URL into my browser i get the expected output. As an FYI- i am not making any adjustments to the "download" tool. My HTTP Action is GET (or FTP)

 

Any tips or inside you might have would be greatly appreciated. Thank you!

 

8 REPLIES 8
BrandonB
Alteryx
Alteryx

Try the attached workflow as a starting point and just switch out your API_Secret in the Headers tab of the download tool.  

 

Mixpanel.png

felixcaspari
7 - Meteor

@BrandonB ,

 

Thank you for the responds and provided workbook! After entering the  API secret (and adjusting the date range) I am now getting a "HHTP/1.1 401 Unauthorized" error message.

 

clipboard_image_0.png

 

The odd thing is that i get the expected output when using the same API secret and running it in a browser. Any type of inside you might be able to provide would be greatly appreciated.

 

Thank you for the assistance!

 

Felix

BrandonB
Alteryx
Alteryx
Ah I missed this part: To make an authorized request, put your project's API Secret in the "username" field of the Basic access authentication header.

So take the api secret value out of the headers tab and instead paste it in the username field of the connection tab
felixcaspari
7 - Meteor

Brandon,

 

I think i am still missing something. I replaced the "API secret" w my "username"

 

clipboard_image_0.png

 

I am not totally following on where to enter the "API_Secret" now that i replaced it from the download.headers tool. Could you please indicate what i might be missing? Thank you for all the assistance!

 

Felix

BrandonB
Alteryx
Alteryx
I am suggesting that you delete the API secret entirely from the headers tab. Then go to the Connection tab up at the top of the download tool configuration window. There is a username and password box. Put your API Secret in the username box
felixcaspari
7 - Meteor

Thank you, that did the trick! Thank you for the provided inside.

 

BrandonB
Alteryx
Alteryx
Glad to help! Every company that has an API seems to have their own little twist on how you connect to it. First step is always to check the documentation. Then determine if it uses an API key like in this case or if it leveraged something like oauth that would require a secondary API call. Practice makes perfect!

I use this list of free APIs on the internet that were put together in order to practice making different connections: https://github.com/public-apis/public-apis/blob/master/README.md
felixcaspari
7 - Meteor

@BrandonB great inside! Thank you for sharing!

Labels