分页
分页用于分批获取列表响应,以减少响应开销并以分页方式呈现数据。
行数
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.
请求参数
| 键 | 值 |
|---|---|
| input_data | { “list_info” : { “row_count” : 3 } } |
上述示例从列表中获取前3条记录。
注意
The default value for row_count is 10.
起始索引
起始索引用于指定从哪个索引开始获取数据记录。
start_index - start index to get records.
给定示例从索引1开始获取3条记录。
注意
The default value for start_index is 1.
$ curl -G <service domain|custom domain>/app/<portal>/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 = "<service domain|custom domain>/app/<portal>/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 = "<service domain|custom domain>/app/<portal>/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 = "<service domain|custom domain>/app/<portal>/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": [
{...},
{...},
{...},
]
}
如何使用起始索引获取下N条记录?
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 <service domain|custom domain>/app/<portal>/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 = "<service domain|custom domain>/app/<portal>/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 = "<service domain|custom domain>/app/<portal>/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 = "<service domain|custom domain>/app/<portal>/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 - page number to get records.
请求参数
| 键 | 值 |
|---|---|
| input_data | { “list_info” : { “page” : 3 } } |
上述示例获取第3页。 如何使用页数获取下N条记录?
注意
The default value for page is 1.
上一页
The next n records can be fetched by requesting records with
updated page as page + 1.
page (new) = page (previous) + 1
$ curl -G <service domain|custom domain>/app/<portal>/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 = "<service domain|custom domain>/app/<portal>/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 = "<service domain|custom domain>/app/<portal>/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 = "<service domain|custom domain>/app/<portal>/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": [
{...},
{...},
{...},
]
}