tombarys Posted July 25, 2017 Share Posted July 25, 2017 Dear Alfred lovers, is any of you able to create simple search API for Airtable? (or use Airtable as my referral link if you wish). It uses REST API and there is a very good documentation for it (but I am not skilled for creating the workflow yet :) – docs: https://airtable.com/api. I am pretty surprised there is still no even one workflow for it. Thanks. Link to comment
deanishe Posted July 25, 2017 Share Posted July 25, 2017 (edited) 2 hours ago, tombarys said: I am pretty surprised there is still no even one workflow for it. I'm sure there are plenty of workflows for Airtable. Just no public ones. If you've read the API docs, you'll be aware that the API is entirely dependent on the structure of your personal databases. A workflow for one of my databases won't work with yours. The API itself is very simple to use. I could write a workflow for one of my own tables in a few minutes. As a result, it's just not worth spending a few days writing a reconfigurable workflow that could work with any table. It'd take just as long to configure the thing as it would to copy and edit a table-specific workflow. As the API is very simple to use, it would be a great first workflow to build. I'm sure that if you try, you'll get all the help you need on the forum. Edited July 25, 2017 by deanishe vitor 1 Link to comment
benh Posted September 29, 2017 Share Posted September 29, 2017 @tombarys I made a simple "add record" workflow today for adding tasks to a backlog. It has one base hardcoded and doesn't do any searching. https://www.dropbox.com/s/srg4qpydba2zokp/Create Airtable record - COPY.alfredworkflow?dl=0 In this example, you'll need to tweak the script: 1. add your API key where it says YOUR_API_KEY (get it from airtable.com/account) 2. add the URL to your base where it says YOUR_TABLE_URL 3. change the fields (e.g. Title, Status) to match your table Right now, mine is hardcoded with the fields from my table. You'll see that if you type this: air testing then a new record will be created called "testing". journalkeeper 1 Link to comment
amitp27 Posted September 14, 2020 Share Posted September 14, 2020 Can somebody help me with this please. I tried @benh file, but couldn't see where I can edit this from to put in my API data. Thank you! Link to comment
poirpom Posted May 14, 2021 Share Posted May 14, 2021 Hi all, I'm having trouble to make it happen. On 9/29/2017 at 3:58 PM, benh said: In this example, you'll need to tweak the script: 1. add your API key where it says YOUR_API_KEY (get it from airtable.com/account) 2. add the URL to your base where it says YOUR_TABLE_URL 3. change the fields (e.g. Title, Status) to match your table I did follow these steps, referred to the airtable API documentation to double check, and tried adding a record but nothing happened curl -v POST https://api.airtable.com/v0/TABLE_ID \ -H "Authorization: Bearer API_KEY" \ -H "Content-Type: application/json" \ --data '{ "fields": { "Tâche": "{query}", "Tous les X": 1, "Fréquence": "mois", "Notes": "bla bla bla", "Type": "PRO" } }' As you may notice, I simply removed -X between -v and POST as the debugger inside Alfred said it was unnecessary : Note: Unnecessary use of -X or --request, POST is already inferred. (I first tried with -X — nothing happened as well.) When I look at the debugger, connection is established, data seems transferred (as far as i can understand, though). But nothing appears on airtable side. I confess I'm a total beginner here, but it seems i'm on the right path, close to making it happen. Maybe your eyes can see something I don't. Thanks for your advice. Link to comment
deanishe Posted May 15, 2021 Share Posted May 15, 2021 10 hours ago, poirpom said: As you may notice, I simply removed -X between -v and POST as the debugger inside Alfred said it was unnecessary : Note: Unnecessary use of -X or --request, POST is already inferred. (I first tried with -X — nothing happened as well.) You can’t just remove the -X. The option is -X POST. -X is the flag and POST is its value. You’ve removed half the option and now you’re telling cURL to download the URL “POST”. 10 hours ago, poirpom said: Maybe your eyes can see something I don't. We need to see the full output from curl once you’ve fixed the command. If you’re running it with -v, it should output a lot of information in the debugger/your shell. If it's hanging, you could try adding -m 20 to the command to tell curl to timeout after 20 seconds. Link to comment
poirpom Posted May 15, 2021 Share Posted May 15, 2021 46 minutes ago, deanishe said: You can’t just remove the -X. The option is -X POST. -X is the flag and POST is its value. You’ve removed half the option and now you’re telling cURL to download the URL “POST”. My bad. Corrected my mistake, tested it again and here is the data from the debugger (I simply removed both API key and table ID) [08:27:45.354] Create Airtable record - COPY[Keyword] Processing complete [08:27:45.358] Create Airtable record - COPY[Keyword] Passing output 'testing' to Run Script [08:27:46.417] STDERR: Create Airtable record - COPY[Run Script] Note: Unnecessary use of -X or --request, POST is already inferred. % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 52.44.27.144... * TCP_NODELAY set * Connected to airtable.com (52.44.27.144) port 443 (#0) 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* ALPN, offering h2 * ALPN, offering http/1.1 * successfully set certificate verify locations: * CAfile: /etc/ssl/cert.pem CApath: none * TLSv1.2 (OUT), TLS handshake, Client hello (1): } [226 bytes data] * TLSv1.2 (IN), TLS handshake, Server hello (2): { [89 bytes data] * TLSv1.2 (IN), TLS handshake, Certificate (11): { [4838 bytes data] * TLSv1.2 (IN), TLS handshake, Server key exchange (12): { [333 bytes data] * TLSv1.2 (IN), TLS handshake, Server finished (14): { [4 bytes data] * TLSv1.2 (OUT), TLS handshake, Client key exchange (16): } [70 bytes data] * TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1): } [1 bytes data] * TLSv1.2 (OUT), TLS handshake, Finished (20): } [16 bytes data] * TLSv1.2 (IN), TLS change cipher, Change cipher spec (1): { [1 bytes data] * TLSv1.2 (IN), TLS handshake, Finished (20): { [16 bytes data] * SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256 * ALPN, server did not agree to a protocol * Server certificate: * subject: CN=airtable.com * start date: Jun 18 00:00:00 2020 GMT * expire date: Jul 18 12:00:00 2021 GMT * subjectAltName: host "airtable.com" matched cert's "airtable.com" * issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon * SSL certificate verify ok. > POST <TABLE_ID> HTTP/1.1 > Host: airtable.com > User-Agent: curl/7.64.1 > Accept: */* > Authorization: Bearer <API_KEY> > Content-Type: application/json > Content-Length: 141 > } [141 bytes data] * upload completely sent off: 141 out of 141 bytes < HTTP/1.1 404 Not Found < Cache-control: no-cache="set-cookie" < Content-Type: text/html; charset=utf-8 < Date: Sat, 15 May 2021 06:27:46 GMT < ETag: W/"10563-BWQgW3iHu0TioWQmC3CGFAxyXrc" < Referrer-Policy: same-origin < Server: Tengine < Set-Cookie: brw=brweHyXOJTHdAPvv0; path=/; expires=Sun, 15 May 2022 06:27:46 GMT; domain=.airtable.com; samesite=none; secure < Set-Cookie: __Host-airtable-session=eyJzZXNzaW9uSWQiOiJzZXNpaUZMUVFFUXdjQ1dPayJ9; path=/; expires=Sun, 15 May 2022 06:27:46 GMT; samesite=none; secure; httponly < Set-Cookie: __Host-airtable-session.sig=WxLPyOfKexKnH3MMgAv4nF3Cs_AkL3zI3ZNkONlYAIU; path=/; expires=Sun, 15 May 2022 06:27:46 GMT; samesite=none; secure; httponly < Set-Cookie: AWSELB=F5E9CFCB0C87D62DB5D03914FDC2A2D2D45FBECE920025D3C55287816E4AE3E4B24EF7E36B91AC3560650744EDFEAB3519A6F71FB93A2BB4F5796755FDCDE92BC243D7D585;PATH=/ < Set-Cookie: AWSELBCORS=F5E9CFCB0C87D62DB5D03914FDC2A2D2D45FBECE920025D3C55287816E4AE3E4B24EF7E36B91AC3560650744EDFEAB3519A6F71FB93A2BB4F5796755FDCDE92BC243D7D585;PATH=/;SECURE;SAMESITE=None < Strict-Transport-Security: max-age=31536000; includeSubDomains; preload < Vary: Accept-Encoding < X-Content-Type-Options: nosniff < X-Frame-Options: SAMEORIGIN < X-XSS-Protection: 1; mode=block < Content-Length: 66915 < Connection: keep-alive < { [15102 bytes data] 100 67056 100 66915 100 141 68490 144 --:--:-- --:--:-- --:--:-- 68564 * Connection #0 to host airtable.com left intact * Closing connection 0 Link to comment
deanishe Posted May 15, 2021 Share Posted May 15, 2021 53 minutes ago, poirpom said: HTTP/1.1 404 Not Found Your URL is wrong. I can't tell you why because you redacted it… There's no harm posting the URL (with the table ID) as long as you don't post your API key. Link to comment
poirpom Posted May 15, 2021 Share Posted May 15, 2021 URL was wrong, indeed. I made a mix up between the workflow example and the airtable documentation I changed the URL in the script according to the airtable documentation using this format : https://api.airtable.com/v0/TABLE_ID Which, in my case, gives this : https://api.airtable.com/v0/appUQbCINAbApLJji/T%C3%A2ches Tried again. 404 disappeared, but a 422 unprocessable entity appeared instead [09:54:16.812] Create Airtable record - COPY[Keyword] Processing complete [09:54:16.812] Create Airtable record - COPY[Keyword] Passing output 'testing' to Run Script [09:54:17.629] STDERR: Create Airtable record - COPY[Run Script] Note: Unnecessary use of -X or --request, POST is already inferred. % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying 54.167.171.239... * TCP_NODELAY set * Connected to api.airtable.com (54.167.171.239) port 443 (#0) * ALPN, offering h2 * ALPN, offering http/1.1 * successfully set certificate verify locations: * CAfile: /etc/ssl/cert.pem CApath: none * TLSv1.2 (OUT), TLS handshake, Client hello (1): } [230 bytes data] * TLSv1.2 (IN), TLS handshake, Server hello (2): { [89 bytes data] * TLSv1.2 (IN), TLS handshake, Certificate (11): { [4827 bytes data] * TLSv1.2 (IN), TLS handshake, Server key exchange (12): { [333 bytes data] * TLSv1.2 (IN), TLS handshake, Server finished (14): { [4 bytes data] * TLSv1.2 (OUT), TLS handshake, Client key exchange (16): } [70 bytes data] * TLSv1.2 (OUT), TLS change cipher, Change cipher spec (1): } [1 bytes data] * TLSv1.2 (OUT), TLS handshake, Finished (20): } [16 bytes data] * TLSv1.2 (IN), TLS change cipher, Change cipher spec (1): { [1 bytes data] * TLSv1.2 (IN), TLS handshake, Finished (20): { [16 bytes data] * SSL connection using TLSv1.2 / ECDHE-RSA-AES128-GCM-SHA256 * ALPN, server did not agree to a protocol * Server certificate: * subject: CN=api.airtable.com * start date: Jun 22 00:00:00 2020 GMT * expire date: Jul 22 12:00:00 2021 GMT * subjectAltName: host "api.airtable.com" matched cert's "api.airtable.com" * issuer: C=US; O=Amazon; OU=Server CA 1B; CN=Amazon * SSL certificate verify ok. > POST /v0/appUQbCINAbApLJji/T%C3%A2ches HTTP/1.1 > Host: api.airtable.com > User-Agent: curl/7.64.1 > Accept: */* > Authorization: Bearer API_KEY > Content-Type: application/json > Content-Length: 141 > } [141 bytes data] * upload completely sent off: 141 out of 141 bytes < HTTP/1.1 422 Unprocessable Entity < access-control-allow-headers: authorization,content-length,content-type,user-agent,x-airtable-application-id,x-airtable-user-agent,x-api-version,x-requested-with < access-control-allow-methods: DELETE,GET,OPTIONS,PATCH,POST,PUT < access-control-allow-origin: * < Content-Type: application/json; charset=utf-8 < Date: Sat, 15 May 2021 07:54:17 GMT < ETag: W/"53-MgccoXpObT/Sg0tPHVP7Hww5eMM" < Server: Tengine < Set-Cookie: brw=brwar6XLAfvTxhlrm; path=/; expires=Sun, 15 May 2022 07:54:17 GMT; domain=.airtable.com; samesite=none; secure < Strict-Transport-Security: max-age=31536000; includeSubDomains; preload < Vary: Accept-Encoding < X-Content-Type-Options: nosniff < X-Frame-Options: DENY < Content-Length: 83 < Connection: keep-alive < { [83 bytes data] 100 224 100 83 100 141 113 192 --:--:-- --:--:-- --:--:-- 306 * Connection #0 to host api.airtable.com left intact * Closing connection 0 Link to comment
deanishe Posted May 15, 2021 Share Posted May 15, 2021 3 hours ago, poirpom said: Tried again. 404 disappeared, but a 422 unprocessable entity appeared instead Yes. That means the JSON data you sent the API are invalid. But you didn't post that information, either. Delete your API key from the workflow, then upload it somewhere and post a link, so we can see what you're actually doing. Link to comment
Lennon Posted May 28, 2022 Share Posted May 28, 2022 It could be that one of your fields required the input to be formatted as an array instead of an object. if you have a single select field or something like that it needs to be an array or it won't work. Link to comment
robdeets Posted May 11, 2023 Share Posted May 11, 2023 Hey Alfredos, Just came across this while looking for an Alfred Workflow for Airtable myself, and noticed this uses the API key. Flagging that the API key is now depreciated, and will be shut down 1st Feb 2024. Users must move to a Personal Access Token or OAuth. That's all! Just posting just in case other newbies come across this and try to install. Cheers Rob Damoeire 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now