Hello. I’m using your API to build my own UI and I faced an issue with order_by property. Is there any way to sort by system fields like id or order? I tried to sort by id and I’ve received an error “The field id was not found in the table”.
Hey there @dpetrenko
This can depend on the endpoint you are requesting. Could you clarify which endpoint you tried to use and what exactly the payload looked like?
Thanks
I use this one /database/rows/table/{table_id}
Hey, thanks for providing the url.
I had a quick look at the code, and it does seem like we might be restricting the order_by
to just fields. But I also understand that if you don’t use order_by
at all, it should be sorted by the field id or am I mistaken there?
What exactly is the response you are getting and how does that response differ from what you expected?
Thanks for the quick reply.
By default data is sorted by id but in this case the last added item will be at the end of list so I try to have it on top of list so looks like I need to use order_by with -id value but it does not work.
I see, you want to sort by id
but descending
instead of ascending
.
Given that this isn’t possible in our UI either, I can imagine that we don’t support an ordering like that.
Not sure what the impact would be if we would allow an ordering like that (on a code refactor level). But this could be suggested as a feature and we can discuss internally if it’s feasible.
Feel free to create a new feature request on our gitlab page if you want to!
I got it. Thanks a lot!