Back

Rest return orderAsc for attribute

  • 0
  • Self Hosted
  • REST API
Capone
8 Mar, 2024, 15:17

Currently appending this onto the end of th url. Using %22 for the " as otherwise Java does not like the " being apart of the url.

/documents?queries[]=orderAsc([%22levelNumber%22])

Resulting in a 500 error.

TL;DR
Developers are encountering a 500 error when trying to sort attributes in ascending order using the Appwrite API. The issue appears to be caused by extra double quotes in the request. An important note is to ensure permissions are correctly set for the relationship and document being accessed. Additionally, check the Appwrite container logs for more details on the error. One potential solution provided is to use the following format for sorting: `/documents?queries[]=orderAsc([%22levelNumber%22])`. This should correctly order the results by the 'levelNumber' attribute.
Steven
8 Mar, 2024, 15:36

what's your project id?

D5
8 Mar, 2024, 15:40

Is this Appwrite cloud?

Capone
8 Mar, 2024, 15:41

Sorry - This is self hosted. The project id is currently being sent by headers - here is my code to make it clearer.

Capone
8 Mar, 2024, 15:42

I have tried doing con.setRequestProperty("queries","orderAsc('levelNumber')") which also hasn't worked

D5
8 Mar, 2024, 15:45

Do you have any relationship?

D5
8 Mar, 2024, 15:45

Are you sure that permissions are set correctly for the relationship and for the document you're getting?

Steven
8 Mar, 2024, 15:46

You can check the docker logs of the appwrite container to see what the 500 error is for

Capone
8 Mar, 2024, 15:52

I have no relationships - its a really simple project. everyone is granted permissions to CRUD. It's only a school project.

Capone
8 Mar, 2024, 15:52

Good idea, will check that now.

Capone
8 Mar, 2024, 15:58

It seems the issue stems from the " -

Capone
8 Mar, 2024, 15:58
Steven
8 Mar, 2024, 15:59

Oh right. There are extra double quotes

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more