Skip to main content
Solved

Attachment upload via API results in error ""INVALID_ATTACHMENT_OBJECT""

  • November 19, 2020
  • 3 replies
  • 239 views

I’m trying to update an existing record by adding an attachment with a url that points to a remote jpg file. I’m getting the error “INVALID_ATTACHMENT_OBJECT”, which is not very helpful.

curl -v -X PATCH https://api.airtable.com/v0/applxOrnAao5mXXXfek/Table%201
-H “Authorization: Bearer xxx”
-H “Content-Type: application/json”
–data ‘{
“records”: [
{
“id”: “recySiYkz0crwyS5P”,
“fields”: {
“Notes”: “testing 1”,
“Attachments”: [
{
“id”: “1”,
“size”: 26317,
“url”: “https://www.filepicker.io/api/file/5YTJXioCQG0tYWPw6OPw”,
“type”: “image/jpeg”
}
]
}
}
]
}’

I’m relatively new to the API so perhaps it’s something I’ve overlooked.

Thanks

Best answer by David_Swearinge

Dang I think that worked. I really appreciate that. So then will it get it’s own random id? and is not having size an issue?

3 replies

Forum|alt.badge.img+19
  • Inspiring
  • 3263 replies
  • November 19, 2020

Hi David, and welcome to the community!

Um, just for yuks, try removing id, size, and type from the attachment data.


  • Author
  • New Participant
  • 2 replies
  • Answer
  • November 19, 2020

Dang I think that worked. I really appreciate that. So then will it get it’s own random id? and is not having size an issue?


Forum|alt.badge.img+19
  • Inspiring
  • 3263 replies
  • November 19, 2020

Dang I think that worked. I really appreciate that. So then will it get it’s own random id? and is not having size an issue?


Yes, it will generate an ID for the object and I think it computes the size by default. But since we removed three attributes we can’t really be sure which was giving you the error. You could spend the rest of the day hunting for the true cause, or kick back and enjoy the afternoon. :winking_face: