Pagination, Sorting, Filtering
Pagination
Clients may request a subset of results returned by a list resource in response to a GET request. This can be done by specifying two optional query string parameters: offset – a 0-based index of first object in the list to return (defaults to 0); and limit – number of objects to return in the result (defaults to 100).
Total count
By default, each list resource returns the total number of objects it contains before pagination is applied (but after any value filters are applied). This value is returned in X-Total-Count: <number> header; this makes it possible to obtain the object count without the actual results via a HEAD request, e.g.
X-Total-Count: 3
Field selection
It is possible to select a subset of fields (object properties) to return instead of all available fields. This can be done by specifying one or more "fields" parameters in the query string. The value of this parameter is a comma-separated list of property paths to include in the response. Each property path is a dot-separated list of object property names. E.g.,
fields=id,spkey,name&fields=endpoints.id,endpoints.name
Sorting
Collection results may be explicitly sorted by one or more properties by specifying them in the "sort" query string parameter. It is a comma-separated list of property names optionally followed by :asc or :desc to specify sort direction (defaults to asc).
Date format details
When filtering the data for Users, Applications, Package Keys and Portal Access Groups, you can use Created and Updated date ranges through the API Calls. The following are the date formats which are allowed/recommended in the API Calls as request param to fetch the data:
Date format | Example | Description |
yyyy-mm-ddThh:mm:sszzz | 2021-01-04T02:10:30-05:30 | Converts the dates into PST by using timezone offset. |
yyyy-mm-ddThh:mm:ss | 2021-01-04T02:10:30 | Considers this date timezone as GMT and convert dates into PST. |
yyyy-mm-dd | 2021-01-04 | Keeps this date as is. |
Note: Using the date format of yyyy-mm-ddThh:mm:sszzz is the most reliable format as the API will return an accurate response since the data gets stored in the DB in PST format.
Query string parameter summary
Parameter | Type | Description |
offset | int | 0-based index of first object in the list to return. Defaults to 0 for /service and /packages APIs. For /members, /applications, /packageKeys, and /roles APIs, the offset field functions as a page index, where the first page is indexed as 0. |
limit | int | Number of objects to return in the result. Defaults to 100. |
fields | string | Comma-separated list of property paths to include in response. Each property path is a dot-separated list of object property names. |
filter | string | Colon-separated name/value pair specifying the name of property whose value must contain the given value (as a substring). Results may also be filtered by nested collections' properties by specifying a dot-separated property path. |
sort | string | Comma-separated list of properties to sort by. Only root-level properties are supported. Each property name may be optionally followed by :asc or :desc to specify sort direction (defaults to asc). |
indent | boolean | When set to "true", responses are indented for better readability. |
Docs Navigation
- API Documentation Portal
- IO Docs Definition
- Mashery API Documentation
- Mashery 3.0 API Guide
- Mashery 2.0 API Guide
- OAuth Supporting Methods
- Examples
- JSON RPC
- Authentication
- API Objects
- Fetching Objects
- Query Language
- Creating Objects
- Updating Objects
- Validating Fields
- Deleting Objects
- Applications
- General Object Methods
- Members
- Packages
- Plans
- Package Keys
- Keys
- Developer Classes
- Services
- Roles
- Mashery 2.0 Reporting API Guide
- Event Trigger API
- Differences between Roles and Portal Access Groups
- Managing a Portal Access Group Using Mashery V2 or V3 API
- Mashery Reporting Event Post API Guide
- Tips and Tricks
- Your Portal
- API Traffic Manager
- I/O Docs WSDL requirements