Calling List APIs

Access List APIs with GET HTTP requests. List APIs return a list of records that match the criteria that is specified in the request parameters.

REST List requests use getNameList APIs, where Name is the type of resource that you specify in the request. To see the complete list of resources and APIs, view the REST Javadoc files.

Request format

Use the following HTTP request format to call List APIs:

GET https://host:port/contextRoot/restapi/Name?parameters

The following example shows a REST call to getOrganizationList:

GET https://host:port/contextRoot/restapi/organization?IsNode=Y&OrganizationName=~like~DEMO 

Query filtering

In a REST List API call, you can filter results according to attribute/value parameters that are specified in the query. In the getOrganizationList example, IsNode=Y and OrganizationName=~like~DEMO are attribute/value parameters. Attribute/value parameters are separated by ampersands (&) in the request URL.

You can specify the relationship between attributes and their values with the following formatting options:

Format Description
attribute=value attribute equals value.
attribute=~neq~value attribute does not equal value.
attribute=~gt~value attribute is greater than value.
attribute=~gteq~value attribute is greater than or equal to value.
attribute=~lt~value attribute is less than value.
attribute=~lteq~value attribute is less than or equal to value.
attribute=~ew~value attribute ends with value.
attribute=~sw~value attribute starts with value.
attribute=~like~value attribute is like value.

Sorting results

To arrange response data in sequence according to specific attributes, pass the sort parameter and the attributes that you want to sort by in the request URL:
sort({+ or -}attribute1,{+ or -}attribute2)
+ Sort in ascending order
- Sort in descending order
The following example shows a REST call to getOrganizationList with the sort function passed as a parameter:
GET /restapi/organization?sort(+OrganizationName,-Createts)
Alternatively, you can pass the _sort parameter in the request URL if you want the request parameters to have the format attribute=value. The following example shows the format of an identical sequencing request that uses the _sort parameter.
GET /restapi/organization?_sort=+OrganizationName,-Createts

Pagination

Pagination is controlled by the HTTP Range header. For example, specifying a Range header with value items=20-39 returns the 20th through 39th items from the query.

Alternatively, you can pass the _range parameter in the request URL. Use this option if you encounter issues with the Range header:

GET /restapi/organization?_range=20-39