Pagination
Pagination is used for fetching list response in batches to reduce response overhead and to render data in pages.
Row Count
Row Count determines the number of rows of data to be rendered per page. It is
represented as n
records.
row_count
- determines number of objects to be provided in list response.
Request Parameters
Key | Value |
---|---|
input_data | { “list_info” : { “row_count” : 3 } } |
The above example gets first 3 records from get list.
Note
The default value for row_count
is 10.
Start Index
Start Index is used to mention the index from which the data records needs to be fetched.
start_index
- start index to get records.
The given example gets 3 records starting from index 1.
Note
The default value for start_index
is 1.
$ curl -G api/v3/requests
-X GET
-H "Accept: application/vnd.manageengine.sdp.v3+json"
-H "Authorization: Zoho-Oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"
-H "Content-Type: application/x-www-form-urlencoded"
--data-urlencode input_data={
“list_info” : {
“row_count” : 3,
“page” : 1
}
}
// Deluge Sample script
url = "api/v3/requests";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {
“list_info” : {
“row_count” : 3,
“page” : 1
}
};
params = {"input_data": input_data};
response = invokeurl
[
url: url
type: GET
parameters: params
headers: headers
];
info response;
#Powershell version - 5.1
$url = "api/v3/requests"
$headers = @{"Accept"="application/vnd.manageengine.sdp.v3+json";
"Authorization"= "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"}
$input_data = '{
“list_info” : {
“row_count” : 3,
“page” : 1
}
}'
$data = @{ 'input_data' = $input_data}
$response = Invoke-RestMethod -Uri $url -Method get -Body $data -Headers $headers -ContentType "application/x-www-form-urlencoded"
$response
#Python version - 3.8
#This script requires requests module installed in python.
import requests
import json
url = "api/v3/requests"
headers ={"Content-Type": "application/x-www-form-urlencoded",
"Accept":"application/vnd.manageengine.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"}
list_info ={“list_info” : { “row_count” : 3,“page” : 1 }}
params = {"input_data": json.dumps(list_info)}
response = requests.get(url,headers=headers,params=params,verify=False)
print(response.text)
{
"response_status": [
{
"status_code": 2000,
"status": "success"
}
],
"list_info": {
"has_more_rows": false,
"start_index": 1,
"page": 1,
"row_count": 3
},
"requests": [
{...},
{...},
{...},
]
}
How to get next N records using start index?
The next n
records can be fetched by requesting records with
updated start_index
as start_index + row_count
index.
start_index (new) = start_index (previous) + row_count
= 3 + 1 = 4
$ curl -G api/v3/requests
-X GET
-H "Accept: application/vnd.manageengine.sdp.v3+json"
-H "Authorization: Zoho-Oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"
-H "Content-Type: application/x-www-form-urlencoded"
--data-urlencode input_data= '{
“list_info” : {
“row_count” : 3,
“start_index” : 4
}
}'
// Deluge Sample script
url = "api/v3/requests";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {
“list_info” : {
“row_count” : 3,
“start_index” : 4
}
};
params = {"input_data": input_data};
response = invokeurl
[
url: url
type: GET
parameters: params
headers: headers
];
info response;
#Powershell version - 5.1
$url = "api/v3/requests"
$headers = @{"Accept"="application/vnd.manageengine.sdp.v3+json";
"Authorization"="Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"}
$input_data = '{
“list_info” : {
“row_count” : 3,
“start_index” : 4
}
}'
$data = @{ 'input_data' = $input_data}
$response = Invoke-RestMethod -Uri $url -Method get -Body $data -Headers $headers -ContentType "application/x-www-form-urlencoded"
$response
#Python version - 3.8
#This script requires requests module installed in python.
import requests
import json
url = "api/v3/requests"
headers ={"Content-Type": "application/x-www-form-urlencoded",
"Accept":"application/vnd.manageengine.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"}
list_info = {“list_info” : { “row_count” : 3,“start_index” : 4}}
params = {"input_data": json.dumps(list_info)}
response = requests.get(url,headers=headers,params=params,verify=False)
print(response.text)
{
"response_status": [
{
"status_code": 2000,
"status": "success"
}
],
"list_info": {
"has_more_rows": false,
"start_index": 4,
"row_count": 3
},
"requests": [
{...},
{...},
{...},
]
}
Page
The page determines the page number from which the records needs to be fetched, also start index will be calculated internally using the page provided.
page
- page number to get records.
Request Parameters
Key | Value |
---|---|
input_data | { “list_info” : { “page” : 3 } } |
The above example gets 3rd page.
Note
The default value for page
is 1.
How to get next N records using page?
The next n
records can be fetched by requesting records with
updated page
as page + 1
.
page (new) = page (previous) + 1
$ curl -G api/v3/requests
-X GET
-H "Accept: application/vnd.manageengine.sdp.v3+json"
-H "Authorization: Zoho-Oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"
-H "Content-Type: application/x-www-form-urlencoded"
--data-urlencode input_data= {
“list_info” : {
“row_count” : 3,
“page” : 2
}
}
// Deluge Sample script
url = "api/v3/requests";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {
“list_info” : {
“row_count” : 3,
“page” : 2
}
};
params = {"input_data": input_data};
response = invokeurl
[
url: url
type: GET
parameters: params
headers: headers
];
info response;
#Powershell version - 5.1
$url = "api/v3/requests"
$headers = @{"Accept"="application/vnd.manageengine.sdp.v3+json";
"Authorization"= "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"}
$input_data = '{
“list_info” : {
“row_count” : 3,
“page” : 2
}
}'
$data = @{ 'input_data' = $input_data}
$response = Invoke-RestMethod -Uri $url -Method get -Body $data -Headers $headers -ContentType "application/x-www-form-urlencoded"
$response
#Python version - 3.8
#This script requires requests module installed in python.
import requests
import json
url = "api/v3/requests"
headers ={"Content-Type": "application/x-www-form-urlencoded",
"Accept":"application/vnd.manageengine.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"}
list_info ={“list_info” : { “row_count” : 3,“page” : 2}}
params = {"input_data":json.dumps(list_info)}
response = requests.get(url,headers=headers,params=params,verify=False)
print(response.text)
{
"response_status": [
{
"status_code": 2000,
"status": "success"
}
],
"list_info": {
"has_more_rows": false,
"start_index": 4,
"page": 2,
"row_count": 3
},
"requests": [
{...},
{...},
{...},
]
}