Airtable database http call help needed


#1

1) Give a description of the problem
I am having trouble getting an https call to work from a piston to be able to authenticate then update a table in the airtable system.

2) What is the expected behavior?
Need the https calls to work! Does anyone have a working example for http calls to airtable?

The shell script code below works:
curl -v -XPOST https://api.airtable.com/v0/appA7ZtfZ5revgRRi/TestTable?api_key=xxxxxxxxxxxxxxx
-H “Content-Type: application/json”
-d ‘{
“fields”: {
“Name”: “test name5”,
“Notes”: “test note5”
}
}’

3) What is happening/not happening?
This is the error info I get back from what I have coded so far:
Error executing external web request: groovyx.net.http.HttpResponseException: Unprocessable Entity

4) Post a Green Snapshot of the pistonimage

5) Attach any logs (From ST IDE and by turning logging level to Full)
The only log at this time is that the http call fails and the response variable is null.


#2

I am able to simulate passing {"fields":{"Name":"Joe","Notes":"blah blah"}} but having trouble with the ‘-d’ switch/flag. Maybe @ipaterson can give pointer.


#3

Are you able to authorize to the airtable database? I have actually made a little bit of progress in the formatting it seems but I am getting this error when trying to get the http command to initialize:

42%20PM


#4

Yeah, I get the 200 response actually…

https://api.airtable.com/v0/appJ0S5MMbl/TestTable?api_key=key3myKeyt68

Edit: This is the json data…
image


#5

Can you post a screen shot of how you formatted the URL in the IDE (the actual edit screen).


#6

Holy &^(* it worked without the flag. One sec


#7

Wow, I am still getting “Unprocessable Entity” message. Still no luck. Can you see anything I am missing in the images below. I have tried to replicate what you have done but something is still amiss.

Screen_Shot_2019-01-25_at_4_30_31_PM


#8

Change the airtableAdd variable name to fields.

Edit: That doesn’t seem to be related to the data being sent though. Hmm, log $httpStatusCode also and see what you get.


#9

That was it!!! I didn’t realize that the name of the variable made a difference but apparently since “fields” is what is being expected in the call before the actual table variables that makes the difference. It must actually take the name of the variable and format the call accordingly.

Thanks much!


#10

Good deal! I was curious about the airtable service, nice to have that info for projects.


#11

I had this airtable call working for several days then it just started failing with the following error:
05%20AM

Has anyone seen this before or have an idea as to how to fix this???


#12

Never mind. I figured it out. I had changed a global variable name that was being referenced in the fields variable. So it was causing the expression to not be able to be built and hence the fields variable was not set correctly. When I changed the global variable to be correct, that resolved the problem. Cock pit error in this case!