Highlighted
MichaelQ Super Contributor.
Super Contributor.
219 views

ServiceAPI SortBy

Jump to solution

Hi all, I'm trying to get the ServiceAPI to sort my search results but am not having much luck.

So far the only valid input I've found is "number" and that's only because that's the example given in the Swagger doco.

I've tried string versions of propertyids/property names, searchclauseids and sortfield to no avail.

Does anyone know of a comprehensive list of the values I can use in the 'sortBy' clause of a ServiceAPI URL? 

Alternatively, just knowing how to sort by title and date registered would be nice.

Thanks,

Michael

0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

Re: ServiceAPI SortBy

Jump to solution

Hi Michael,

I hope you are enjoying the sunshine up there.

The code that ends up getting called when you pass something into sortBy is this:

Search.SetSortString(string.Join(" ", request.sortBy));

So these all work for me:

http://localhost/ServiceAPI/record?q=all&sortby=registeredon - Date Registered sort

http://localhost/ServiceAPI/record?q=all&sortby=registeredon- - Date Registed descending (note the minus sign at the end)

http://localhost/ServiceAPI/record?q=all&sortby=recTypedTitle - by Title, this one is a bit of a trick as recTitle does not work.

 


Blog | Samples | HPE CM 9.3 SDK Docs
**Any opinions expressed in this forum are my own personal opinion and should not be interpreted as an official statement on behalf of MicroFocus**
0 Likes
2 Replies
Micro Focus Expert
Micro Focus Expert

Re: ServiceAPI SortBy

Jump to solution

Hi Michael,

I hope you are enjoying the sunshine up there.

The code that ends up getting called when you pass something into sortBy is this:

Search.SetSortString(string.Join(" ", request.sortBy));

So these all work for me:

http://localhost/ServiceAPI/record?q=all&sortby=registeredon - Date Registered sort

http://localhost/ServiceAPI/record?q=all&sortby=registeredon- - Date Registed descending (note the minus sign at the end)

http://localhost/ServiceAPI/record?q=all&sortby=recTypedTitle - by Title, this one is a bit of a trick as recTitle does not work.

 


Blog | Samples | HPE CM 9.3 SDK Docs
**Any opinions expressed in this forum are my own personal opinion and should not be interpreted as an official statement on behalf of MicroFocus**
0 Likes
MichaelQ Super Contributor.
Super Contributor.

Re: ServiceAPI SortBy

Jump to solution

You're a rock star David! 🕺🎸 🤠

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.