Querying for a Siebel CRM Repository Resource with a Sort Specification
You can query for a particular Siebel CRM Repository Resource, and sort its response in either an ascending or descending order by stating the sortspec parameter in the request. This provides you with a REST Get API response that is already sorted in a particular order, without the need to code any additional sorting scripts.
The sortspec parameter contains a comma separated list of field:sortorder pairs where spaces before and after the equals sign (=) and colon ( : ) are ignored. For example:
sortspec=First Name:desc,Last Name:asc
The keywords for ascending and descending order are asc
and
desc
respectively. In the following example, the query first sorts
the records in ascending order of Citizenship, and then in ascending order of First
Name.
http://ServerName:port/siebel/v1.0/data/Account/1-1/Contact?
sortspec=Citizenship:asc,First Name:asc
When using the sortspec
parameter, the following considerations
apply:
-
If you do not specify the sortspec parameter, or if nothing is specified after the equals sign (=) in the sort specification, then the response is not sorted.
-
When neither an ascending nor descending sort order is specified, the response is returned in ascending order by default.
-
This parameter applies only to GET URLs of /data and /workspace APIs.
-
You can only use the sortspec parameter on a collection query. If you use it in a single record query, then the sortspec parameter has no effect.
-
You can sort at any level of object (child object, grandchild object, and so on), however, you can apply sortspec to the last object, or the leaf object, in the URI.
-
To avoid an impact on API performance, only use the sortspec parameter when sorting is necessary.
In the following request, the sortspec parameter is set to
Name:asc
, so the returned response is sorted by the field Name in
ascending order.
-
Request URI: http://ServerName:port/siebel/v1.0/workspace/MAIN/Applet?Fields=Name&ChildLinks=None&sortspec=Name:asc&PageSize=3&StartRowNum=2
-
HTTP Method: GET
-
Content-Type: application/json
-
Authorization: Basic
-
Request Body: None
Here are the response details for a successful request:
-
HTTP Code: 200
-
Content-Type: application/json
-
Response Body:
"items": [ { "Name": "A Account Objective Form Applet", "Link": [ ….. ] }, { "Name": "A Account Planning Header Applet", "Link": [ ….. }, { "Name": "A Portfolio Account Detail Applet", "Link": [ ….. } ], "Link": [ …. }
In the following request, the sortspec parameter is set to
Name:desc
, so the returned response is sorted by the field Name in
descending order.
-
Request URI: http://ServerName:port/siebel/v1.0/workspace/MAIN/Applet?Fields=Name&ChildLinks=None&sortspec=Name:desc&PageSize=3
-
HTTP Method: GET
-
Content-Type: application/json
-
Authorization: Basic
-
Request Body: None
Here are the response details for a successful request:
-
HTTP Code: 200
-
Content-Type: application/json
-
Response Body:
{ "items": [ { "Name": "new FINCORP Call Report Activity Form Applet (More)", "Link": [ …. ] }, { "Name": "f", "Link": [ …. ] }, { "Name": "eWireless Page Tab Layout Applet", "Link": [ …. ] } ], "Link": [ …. ] }