Trouble with curl GET from excel 2011 Mac VBA


#1

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

Any ideas?

Edit…
I should note I am using the execShell() function courtesy of Robert Knight via StackOverflow to make the actual call.
https://stackoverflow.com/questions/6136798/vba-shell-function-in-office-2011-for-mac

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.


#2

I have never seen the first type of query return more than 1 record. :thinking:

Does it work now?


#3

anyone???

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??


#4

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’.


#5

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


#6

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.

Node.js with Airtable.js is definitely a much more friendly interface. If you don’t have experience with JavaScript, watch out for “callback/async” semantics.


#7

Also, have you tried copying curl commands from the API docs into the terminal? If any of those don’t work, please email support@airtable.com.


#8

Thanks Alexander!! It was the missing single quotes.

n00b + Syntax = frustration.