Alteryx Designer Desktop Discussions

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

Another Download Tool/cURL Question; -d flag?

aMac
8 - Asteroid

I have some experience using the Download tool, even with some especially difficult APIs that seem to have their own way of doing things that make no sense. One such API, Airtable, is causing some grief in that this POST cURL:

 

 

cURL -v -XPOST https://api.airtable.com/v0/[airtable table name] \
-H "Authorization: Bearer [API_KEY]" \
-H "Content-type: application/json" \
 -d '{
	 "fields": { 
	 "Field 1":"Value 1", 
	 "Field 2":"Value 2"
	 }
 }

returns an Error from Airtable's API saying: "{"error":{"type":"INVALID_REQUEST_MISSING_FIELDS","message":"Could not find field \"fields\" in the request body"}}"  when I use the Download tools.

 

All the Headers and Endpoints are setup, it's just the stupid -d flag with no specific field or key for that JSON body.

 

Corroborating this, I loaded the cURL into Postman and I noticed that there is no "key", just POST'ing the JSON in the raw Body successfully performs the HTTP call. How do I translate this into the Download tool?

 

(I have referenced this excellent KB article on Download Tool & HTTP calls link)

 

3 REPLIES 3
BenMoss
ACE Emeritus
ACE Emeritus

Compose your JSON as a field (you probably already do this).

 

Then in the 'payload' tab use the 'Take Query String/Body from a field' option, and select your field.

 

This represents the raw body that is passed through in postman.

 

Ben

aMac
8 - Asteroid

Thanks @BenMoss for the reply. Right now I just have a single JSON constructed in a formula field. I have tried both maintaining the spaces and indentation, as well as collapsing it all into one line.

 

Here is the macro setup for Airtable. The data field stores the JSON value that is passed into the macro input.

Screen Shot 2018-08-19 at 10.18.42 AM.png

 

 

Here's a test JSON created in a formula field. This is what is passed into the data field. As you can see from the errors, Airtable is still returning 422 Unprocessable errors

Screen Shot 2018-08-19 at 10.28.38 AM.png

aMac
8 - Asteroid

Ok, circling back on this thread, I found that by whatever strangeness, I was able to get the Download tool working when I changed the header from Content-Type to Content-type and this is the only variable I can recall tweaking to allow me to successfully Create records with this API.

 

If anyone is interested :-)

 

Labels