Example: Paging that uses HTTP link headers
- Last Updated: January 23, 2024
- 2 minute read
- DataDirect Connectors
- JDBC
- Autonomous REST Connector 6.0
- Documentation
The following examples demonstrate the Model file syntax for services that configure paging by passing parameters in headers.
GitHub
When paging is configured in a request to GitHub, the service includes link headers in the
response header. Link headers are comprised of a list of URLs with query parameters that can
be used to fetch pages in a result. Through the query parameters, link headers configure
pagination behavior such as page size and ordinal information. For
example:
link: <https://api.github.com/repositories/1234567/issues?page=2>; rel="prev",
<https://api.github.com/repositories/1234567/issues?page=4>; rel="next",
<https://api.github.com/repositories/1234567/issues?page=200>; rel="last",
<https://api.github.com/repositories/1234567/issues?page=1>; rel="first"To enable paging and set parameters in a request to GitHub, you must to specify certain
properties in the Model file. First, set the #maximumPageSize property to
specify the maximum rows returned in a page. Then, configure the
#nextPageParameter to specify which URI parameter that holds the token to
fetch the next page.
The following example demonstrates configuring next page token paging for the
AllUsers table from a GitHub service. "AllUsers":{
"#maximumPageSize":"30",
"#nextPageParameter":"since",
"#path":[
"IDENTITY users/{login}",
"users"
],
"#headers": {
"Accept": "application/vnd.github.v3+json"
},
"id":"Integer,#key",
//Additional table definition syntax can be populated after paging parameters.
}OKTA
For OKTA services, responses to requests that configure paging include a series of link
headers that are used to fetch pages in the result. Each link header returned represents a
page in the result and includes paging configuration information, such as the page size,
ordinal information, and the cursor ID number. For example:
link: <https://{myDomain}/api/v1/logs?limit=25>; rel="self"
link: <https://{myDomain}/api/v1/logs?limit=25&after=1234567898765_1>; rel="next"To configure paging for OKTA services in a request, you must specify the page size using
the #maximumPageSize property and, via the
#nextPageParameter, the query parameter specifying the token ID number.
The following example demonstrates configuring Next Page Token Paging with the
USERS table from an OKTA service. "USERS": {
"#path": [
"/users"
],
"#maximumPageSize": 20,
"#nextPageParameter": "after",
"id": "VarChar(30),#key",
//Additional table definition syntax can be populated after paging parameters.
}