Post

2 followers Follow
0
Avatar

[REST API] Is it possible to specify the sorting behavior for search results?

In the REST API documentation that describes how to search for the XL Release building blocks, it doesn't mention any parameters for specifying how the search results should be sorted.  

I did notice under the Listing planned or active releases section that "the response contains a page of planned or active releases fetched with given depth, sorted ascending by start date and title".  

Is there a way to express a desired sort when invoking the search/listing REST API's?  If not, are there any plans to provide that capability?

Brandon White

Official comment

Avatar

Hi there,

Yes is possible to select the order, although is not documented, you can use the https://docs.xebialabs.com/xl-release/8.0.x/rest-docs/#find-releases-by-criteria  as:

curl -X POST \
'https://localhost:5516/xlr/api/v1/releases/search?page=0&resultsPerPage=100' \
-d '{
"active": true,
"orderBy": "start_date"
}'

The field "orderBy" accepts the following values: 

  • risk
  • start_date
  • end_date
  • title

The title parameter only works for templates and all the orders are descending.

We will fix it in the documentation soon.

 

 

Angel Gavalda

Please sign in to leave a comment.

1 comment