Pagination

Pagination is applied for some domains of OpsGenie Rest API, meaning that only a certain number of resources will be returned within each response. Specification of page details to return is determined according to following parameters:

Field Names Description Value Definition
offset Starting point for the result set See the related section for each request
direction Page direction to apply for the given offset next: Greater than the given offset (Default Value)
prev: Less than the given offset
limit Maximum number of items to provide in the result Must be a positive integer value. Default value is 20 and maximum value is 100.
sort Name of the field that result set will be sorted by See the related section for each request
order Sorting order of the result set desc: Sort result set in descending order (Default Value)
asc: Sort result set in ascending order

Paging URL Information in Response

If paging information is available for the given filters/queries, exact link of any available next, first and last pages including query parameters are provided within response.

Next Page URL

  • 1. Within X-Paging-Next header
  • 2. Within paging section of the response body. An example paging section within response body is available below.

First Page URL

  • 1. Within X-Paging-First header
  • 2. Within paging section of the response body. An example paging section within response body is available below.

Last Page URL

  • 1. Within X-Paging-Last header
  • 2. Within paging section of the response body. An example paging section within response body is available below.
{
    "data":[
        ...
    ],
    "took": 0.266,
    "requestId": "37daec35-2d65-4612-b568-711068e806a4",
    "paging":{
        "next":"https://api.opsgenie.com/v2/alerts?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&query=status%3Aopen&offset=20&limit=10&sort=createdAt&order=desc",
        "first":"https://api.opsgenie.com/v2/alerts?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&query=status%3Aopen&offset=0&limit=10&sort=createdAt&order=desc",
        "last":"https://api.opsgenie.com/v2/alerts?apiKey=eb243592-faa2-4ba2-a551q-1afdf565c889&query=status%3Aopen&offset=100&limit=10&sort=createdAt&order=desc"
    }
}