Help

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

Topic Labels: API
Solved
Jump to Solution
5304 3
cancel
Showing results for 
Search instead for 
Did you mean: 
David_Swearinge
5 - Automation Enthusiast
5 - Automation Enthusiast

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

1 Solution

Accepted Solutions
David_Swearinge
5 - Automation Enthusiast
5 - Automation Enthusiast

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?

See Solution in Thread

3 Replies 3

Hi David, and welcome to the community!

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

David_Swearinge
5 - Automation Enthusiast
5 - Automation Enthusiast

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: