Cursor-based Pagination
Some responses provide cursor information, allowing you to paginate through the entities/elements/pms/results. It shows what values you can use in your next request to get the next batch of results.
Cursor information is displayed under the"cursor" field and includes the following fields:
|
■
|
"start": Indicates the first result in the queried URL. This can be an index number to represent, for example, an IP Group, or a string to represent, for example, a performance monitoring parameter. |
|
■
|
"before": Indicates what values you can use in you next request to get the previous batch of results located before the queried URL. This can be an index number to represent, for example, IP Groups (elements), or a string to represent, for example, a performance monitoring parameter. The value "-1" indicates that there are no more results to return. |
|
■
|
"after": Indicates what values you can use in you next request to get the next batch of results located after the queried URL. This can be an index number to represent, for example, IP Groups (elements), or a string to represent, for example, a performance monitoring parameter. The value "-1" indicates that there are no more results to return. |
|
■
|
"end": Indicates the last result in the queried URL. This can be an index number to represent, for example, an IP Group ID, or a string to represent, for example, a performance monitoring parameter. |
Example 1
The below requests the first two IP Groups. The response also includes cursor information, which indicates the following:
|
■
|
First IP Group is Index 0 ("start": "0") |
|
■
|
No additional IP Groups exists before the displayed ("before": "-1") |
|
■
|
Next value that can be used to get the next batch of results is "1" ("after": "1") |
|
■
|
Last IP Group result is Index 2 ("end": "2") |
Below is the request and response:
GET /api/v1/kpi/current/sbc/callStats/ipGroup?limit=2 HTTP/1.1
Host: 10.4.219.229
HTTP/1.1 200 OK
Content-Type: application/json
{
"items": [
{
"id":"0",
"name": "Teams PS",
"description": "Teams server",
"url": "/api/v1/kpi/current/sbc/callStats/ipGroup/0"
},
],
"cursor": [
{
"start": "0",
"before": "-1",
"after": "1",
"end": "2"
}
]
}
The below example navigates the above query to the next "page" of results:
GET /api/v1/kpi/current/sbc/callStats/ipGroup?limit=2&after=1 HTTP/1.1
Host: 10.4.219.229
HTTP/1.1 200 OK
Content-Type: application/json
{
"items": [
{
"id":"2",
"name": "ITSP",
"description": "ITSP server",
"url": "/api/v1/kpi/current/sbc/callStats/ipGroup/2"
},
{
"id": "1",
"name": "Teams-c",
"description": "Teams client",
"url": "/api/v1/kpi/current/sbc/callStats/ipGroup/1"
}
],
"cursor": [
{
"start": "0",
"before": "2",
"after": "-1",
"end": "2"
}
]
}
Example 2
The below requests the first two performance monitoring parameters for IP Group ID #0. The response also includes cursor information, which indicates the following:
|
■
|
First performance monitoring parameter is abnormalTerminatedCallsInTotal |
|
■
|
No additional performance monitoring parameter results exist before the displayed |
|
■
|
Next result is performance monitoring parameter abnormalTerminatedCallsOutTotal |
|
■
|
Last result is performance monitoring parameter shortCallsCounterTotal |
Below is the request and response:
GET /api/v1/kpi/current/sbc/callStats/ipGroup/0?detailed=false&limit=2 HTTP/1.1
Host: 10.4.219.229
HTTP/1.1 200 OK
Content-Type: application/json
{
"items": [
{
"id":"abnormalTerminatedCallsInTotal",
"value": "0"
{
"id": "abnormalTerminatedCallsOutTotal",
"value": "0"
}
],
"cursor": [
{
"start": "abnormalTerminatedCallsInTotal",
"before": "-1",
"after": "abnormalTerminatedCallsOutTotal",
"end": "shortCallsCounterTotal"
}
]
}