Alteryx Designer Desktop Discussions

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

Having difficulty setting up API to pull JSON data

adriennelenker
7 - Meteor

Hi all, this is my first time setting up an API. Will only use screenshots because uploads are proprietary. Also, the data must be pulled in as JSON.

 

The workflow is a text input connected to a download tool. The text input has 2 columns, URL and code. The URL column has the URL. the code column has the code in the following format, which was in a guide provided to me.

 

curl -X GET "URL" -H "accept: application/json" -H "apiKey: APIKEY" -H "sid: Username"

The same URL in the URL col is in GET "URL", and the apiKey and Username have my user and the apiKEY given to me.

 

 

For the download tool, on the "Basic" tab the Field is set to "URL" and output is "Blob" to work with JSON.

On the payload tab, the HTTP Action is "Get" and the "Take Query/string" is set to "Code"

 

The issue, is when run, Download data just says "11 bytes" and Download Headers just says "400 Bad Request"

 

Was wondering if the issue is the code format is wrong, or if the Headers tab should be filled in (right now it's left as is). I have a list of the Field names to extract, when I tried to enter one I got the same end result.

 

Thank you

 

3 REPLIES 3
apathetichell
18 - Pollux

You are intermingling different features of your payload and your api is telling you formatting is wrong.

 

" -H "accept: application/json"

this is configured in your download tool headers - as the key pair:

accept application/json

 

-H "apiKey: APIKEY" -H "sid: Username"

this is your authorization -  these should be passed in your header as fields with those keys. 

apiKey {yourAPIKEY}

Username {your Username}

 

also - don't download to blob - if you're getting json - download to string.

 

Is the API you are hitting (aka the provider) proprietery? If not- share the API - they tend to have documentation on how these things shoudl be formatted.

 

I'd also recommend doing htis first in Postman and then transfering what works there to Alteyrx.

adriennelenker
7 - Meteor

Hi @apathetichell  thank you for the response, I will try this. 

 

I have one follow-up Q - I mentioned that I didn't select anything on the "Header" tab - is this right, and the payload is coming in wrong, or should the Header tab have selections? I feel like it should.

 

Also the data is proprietary, but was hoping to troubleshoot the Header tab. Thanks

apathetichell
18 - Pollux

The data is nearly always properitery - the api specs (aka the how you use the api) rarely is. It's usually on the developer site of whatever you are connecting to.

 

Those are all headers - but you do not feed them in like that - they have to be broken out in the Headers tool under specific key/value pairs.

Labels