Problem with API returning fields out of order?


#1

The two fields I need from my base are ‘date’ and ‘venue’ and in the base they are in order by date, that’s how I entered them. When I i retrieve that data via the API, they are out of order, and not in a way that makes sense.

When I try to use the Airtable API Encoder to set the sort order, I get a 422 error. Any ideas how to fix this? Something simple that I’m missing?

Thanks!


#2

You are correct in using the “sort” parameter for sorting the retrieved data.

Could you please also share the “error message” you are receiving, it should hopefully provide some more insight as to what is going wrong.


#3

Here’s what I’m getting when I try to use the sort parameter. Without the parameter everything is returned correctly, though out of order.

56%20PM


#4

Pretty strange…It seems that your array of sort objects is perhaps malformed in your request url.

A work around to this is that you do not pass the sort parameter and create a view on your base that has the data ordered by date
You can then pass in the the above newly created view name as the value to the “view” parameter in the request
The data returned should be in the same order as they appear in that view.