Help

Re: Uploading image files to an attachment field via API

24 0
cancel
Showing results for 
Search instead for 
Did you mean: 
KevinKearns
4 - Data Explorer
4 - Data Explorer

I want to add images to an attachment field in an Airtable.  I've read all of the documentation and Community comments but can't seem to find an answer to my problem.

  • I have a publicly accessible link to the image
  • I can call https://api.airtable.com/v0/{baseID}/{tableID}/{recordID} and add an image fine, however, I want to make multiple other calls adding new versions of the image and this call overwrites what is already there but I want to keep the previously uploaded files.  (I understand this is an Update call and that logic makes sense.)
  • Therefore, I believe I should call  https://content.airtable.com/v0/{baseID}/{recordID}/{fieldID}/uploadAttachment  passing in a similarly formatted JSON object, however, I cannot get that to work.  I get something added to the attachment field, however, it is just 1K gibberish file.

    • Here is a copy of what I'm calling:

      curl --location 'https://content.airtable.com/v0/{baseID}/{recordID}/{fieldID}/uploadAttachment' \
      --header 'Authorization: Bearer {accessToken}' \
      --header 'Content-Type: application/json' \
      --header 'Cookie: {cookie stuff}' \
      --data '{
          "contentType": "image/png",
          "file": "{publicly accessible URL to image}",
          "filename": "Content_Hub_Portraitv2.png"
      }'

    • Any help would be appreciated.

Thanks much.

 

10 Replies 10

Yeah, that is the highly unfortunate thing about Airtable's API Documentation team. When they came out with the new API documentation, they stopped updating the old interactive documentation, so like you said, the old documentation is only a subset of the API calls. It's really an unfortunate situation, all the way around. We should send them feature requests to ask them to keep updating the old interactive documentation.