Attachments get reversed order when uploaded through API


#1

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?


#2

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!


#3

Hi Kasra,

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

Nice to hear it will be fixed, though!


#4

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