Jun 14, 2017 03:51 PM
Trying to use a curl GET from excel VBA 2011 Mac to grab some records. Took me a while to figure out how to get authentication to work, did that, but have hit another bump.
I am copying the GET syntax directly from Paw which returns the correct results. In excel the same syntax does not return the same results. It seems I can only manage to pass a single filter to Airtable.
This code will return ALL records in the Stunning view of BestTableEver.
“curl -X GET --header ‘Authorization: Bearer keyYour_Bearer_Key’ https://api.airtable.com/v0/appYour_Fabs_App/BestTableEver?view=Stunning&maxRecords=1”
This code will return a single record from BestTableEver that is actually filtered out of the Stunning view, but is the first record you get from Paw without naming the view.
“curl -X GET --header ‘Authorization: Bearer keyYour_Bearer_Key’ https://api.airtable.com/v0/appYour_Fabs_App/BestTableEver?maxRecords=1&view=Stunning”
I should note I am using the execShell() function courtesy of Robert Knight via StackOverflow to make the actual call.
And after a little digging here… https://curl.haxx.se/docs/manpage.html I am thinking the problem may be with the “&” after the first filter.
Jun 15, 2017 12:17 AM
I have never seen the first type of query return more than 1 record. :thinking:
Does it work now?
Jun 18, 2017 07:24 AM
No matter what I try I can only filter by the table and one other option, be it a view, or a single filter by formula.
Also no success at all with Patch. I did a curl -h in terminal to show the curl options and Patch and Post aren’t even in there. Anybody doing curl on a mac??
Jun 19, 2017 01:31 AM
FWIW: Your URL is not the problem as far as I can tell.
You can double check that by pasting it in a browser after adding ‘&api_key=XXXXXXX’.
Jun 19, 2017 05:21 AM
I’ve tried encoding with https://codepen.io/airtable/pen/rLKkYB. As near as I can tell it is a limitation of the curl client in OSX, or possibly with the shell function I am passing the curl command through. Anyway it seems like it does not pass anything after the & in the curl GET. Also Patch and Post aren’t in the curl client. So… on to Node.js
Jun 19, 2017 10:40 AM
Curl client on OS X generally works fine. That’s what we use to test out examples in the docs.
Make sure you have single quotes around the URL that gets passed to the shell. If you don’t, the shell will interpret & as ending of command and sending the command to the background.
Jun 19, 2017 10:45 AM
Also, have you tried copying curl commands from the API docs into the terminal? If any of those don’t work, please email firstname.lastname@example.org.
Jun 19, 2017 07:31 PM
Thanks Alexander!! It was the missing single quotes.
n00b + Syntax = frustration.