- Requesting that the results that come back be filtered down to a manageable subset
- Grouping the results into pages of specific length
Filtering API results
Thefields query parameter is identical in design to Google’s design for JSON resource filtering . You can filter the results by populating the fields query parameter with just the fields you want to come back in the response resource.
As an arbitrary example, let’s say you were interested in only the following fields:
defaultClassfields(id,readOnly)idkindlibraryIdnamepermissions(role,type,value)sections(fields/id,id)value
fields query parameter of your request with the preceding list as follows:
%2C).
Example request
For example, if you were adding a new class and wanted the response resource to contain the fields above, the request might look like this:Example response
Here is what the response to that request looks like, filtered with your list:Paginating resource collection responses
For API methods that return a collection of resources, there’s usually the need to be able to paginate the results, as there might be too many of them to fit in a single response. The API methods that support pagination usually have two parameters:- A
limitparameter (also namedpageSizeormaxResultsin some methods) to indicate the maximum number of results to return in a single page - A
pageTokenparameter, used to get subsequent result pages
nextPageToken field.
To get the next page of results, you have to take this nextPageToken from the response and pass it as the pageToken query parameter in the next request (with the other parameters unchanged) to get to the next page.
Note:For performance reasons, we recommend adjusting the number of requested results to the needs of the user. The more results are requested, the larger the latency.