Ordering not working in REST API Search
Bonita 6.3
Using either of the following URLs in the REST API is returning the same result set in the same order, it should be ordering by name.
http://localhost:8084/bonita/API/bpm/humanTask?c=10&p=0&f[]=user_id=103&f[]=state=ready&o=name%20DESC
OR
http://localhost:8084/bonita/API/bpm/humanTask?c=10&p=0&f[]=user_id=103&f[]=state=ready&o=name%20ASC
Why is this not working?
1 answer
Hello, you have an error near f parameter, no need to put "[]". I just tested succesfully with these two links:
http://localhost:8081/bonita/API/bpm/humanTask?c=10&p=0&f=user_id=4&f=state=ready&o=name%20DESC
http://localhost:8081/bonita/API/bpm/humanTask?c=10&p=0&f=user_id=4&f=state=ready&o=name%20ASC
http://localhost:8081/bonita/API/bpm/humanTask?c=10&p=0&f=user_id=4&f=state=ready&o=name%20ASC
Comments
OK, but that is not easy to pass with JQuery or any other javascript library, the only way around it is to construct the URL yourself manually. Normally I will be passing a javascript object to JQuery.ajax(). You cannot have the same key twice in an object as this is not valid in javascript. I am passing the following object as the request paylaod.
The API expects the payload below, this does not work as the same key is specified in the object twice and will throw a javascript exception.
I beleive this is a fault in the current REST API. It should be accepting an array.
Hi jackmatt,
Have you tried to add a traditional : true in your ajax call?
Something like:
Fabio