Help

Attachments get reversed order when uploaded through API

Topic Labels: API
3545 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Tom_Keysers
6 - Interface Innovator
6 - Interface Innovator

Hi,

I’m using airtable.js to migrate a lot of data from Filemaker to Airtable at the moment.

Each record contains a Picture (attachment) field with images. In airtable.js I’m creating an array which contains all correct image urls and filenames per record, which is then being pushed/updated to the relevant record in Airtable.

E.g.:
"Picture": [ { "filename": "1.jpg", "url": "https://www.cloud.com/_2801C_1.jpg" }, { "filename": "2.jpg", "url": "https://www.cloud.com/_2801C_2.jpg" }, { "filename": "3.jpg", "url": "https://www.cloud.com/_2801C_3.jpg" }, { "filename": "4.jpg", "url": "https://www.cloud.com/_2801C_4.jpg" }, { "filename": "5.jpg", "url": "https://www.cloud.com/_2801C_5.jpg" }, ]

Logically, I want the position of my images to stay as stated in the array that I’m pushing, but the result I’m getting in the final Airtable is that picture 5.jpg is first and 1.jpg is last …

This seems like a bug to me … Or am I doing something wrong? Is there a way to maintain the positioning of the images?

3 Replies 3

Hi Tom,

This behavior, while strange, is the expected behavior for this version of the API, so you’ll need to reverse your array to get the order to match the order in the UI.

We will be fixing this in the next version of the API (we can’t change it in this version because it would break people’s existing integrations)

Sorry for the confusion!

Hi Kasra,

Thanks for the reply! I indeed proceeded with a reversed array, which then works like a charm :slightly_smiling_face:

Nice to hear it will be fixed, though!

David_Tcheng
4 - Data Explorer
4 - Data Explorer

Thanks! I was wondering how to upload image attachments using URLs…