May 20, 2020 10:56 PM
Hi! :wave:
I am an intermediate-level Airtable user, and using it since 2yrs. Now I have started learning PHP, and I want to integrate the Airtable API with it.
So, I want to build a simple webpage (in PHP), in which the -
Is this possible to do? If yes, can you refer any Docs/Links which might help me?
Any help is appreciated :slightly_smiling_face:
Thanks!
May 21, 2020 07:22 AM
@Kartik, yes, this is possible.
Here are a few clues.
The Airtable API can upload any images that are publicly addressable. The URL for the image being uploaded must Be openly accessible to Airtable.
You PHP app must host the image in a location where Airtable can access it when you add the image to the attachment field. Airtable does the actual upload behind the scenes when you update the attachment field URL.
The Airtable API documentation is all you need to update the attachment field with a new image source.
PHP is fully able to POST to Airtable via the API using its form actions or you can utilize any of the native JavaScript POST methods as well as the various Airtable SDKs.
May 21, 2020 07:44 AM
Hi, @Bill.French!
Many thanks for the reply! You’ve solved 75% of my problem! :smiley_cat:
So, what if I delete my URL-hosted image after it’s uploaded to Airtable?
More clearly,
Thanks! :slightly_smiling_face:
May 21, 2020 09:58 AM
Indeed, but there’s a flaw in this expectation. Once you complete the post to hand over the URL for Airtable to do its “upload”, which is really the act of making a copy via URL, Airtable needs some time to make the copy. This can take a few seconds or minutes depending on the connection, the size of the file, and the relative business of Airtable itself.
You’ll need to create a sleep-gap in your process to ensure Airtable has had enough time to create the image copy and unfortunately, there’s no call-back to inform you of this. Furthermore, there’s no [obvious] way of testing the field to see if the upload is complete. Or is there? :winking_face:
The way I test to see if an attachment field has a copy of the image is to test for the existence of large or small thumbnail images in the attachment collection. If you request the attachment field and there are thumbnails, the process likely completed. This is almost certainly validation, but there are cases where Airtable is unable to make thumbnails for unknown reasons.
That said, there’s no way to solve your case 100%, but I may have gotten you to 99.5%, eh?