关于分页响应:
1 案例1 :在触发API端点“ organizationalEntityAcls ”,没有任何预测参数时,为我提供默认的分页响应(即)
API : https://api.linkedin.com/v2/organizationalEntityAcls?q=roleAssignee&oauth2_access_token=XXX;
响应:
{"elements": [{"role":"ADMINISTRATOR","roleAssignee":"urn:li:person:xxxxx","state":"APPROVED","organizationalTarget":"urn:li:organization:yyyyy"}],
**"paging":{"count":10,"start":0,"links":[]}}
**
case2:在触发相同的API端点并带有投影时,未提供分页响应(即)
API:
的 https://api.linkedin.com/v2/organizationalEntityAcls?q=roleAssignee&role=ADMINISTRATOR&projection=(elements*(*,roleAssignee~(localizedFirstName, localizedLastName), organizationalTarget~(localizedName)))&oauth2_access_token=xxxx;
响应:
{"elements":[{
0:
organizationalTarget~
localizedName:"xyz",
role :"ADMINISTRATOR",
roleAssignee :"urn:li:person:xxxxxx"
state :"APPROVED"
roleAssignee~
localizedLastName "xyz"
localizedFirstName "aaaa"
organizationalTarget "urn:li:organizationBrand:ddddd"
}]}
// 回复结束
但是没有检索到 PAGING RESPONSE 。
还尝试通过提供分页字段 start和count 来获取相同 case2 的分页响应,这也不会产生分页响应。
因此,需要知道如何使用API中存在的投影参数获取分页响应。
2 分页响应不会限制在API调用中的“开始”和“计数”字段所提到的限制。而不是检索所有结果。
(即)的 API:**** https://api.linkedin.com/v2/organizationalEntityAcls?q=roleAssignee&**start=10&count=10**&oauth2_access_token= XXX;
响应:
{"elements":
**0**[{"role":"ADMINISTRATOR","roleAssignee":"urn:li:person:XXX","state":"APPROVED","organizationalTarget":"urn:li:organization:YYY"},
**1**{"role":"ADMINISTRATOR","roleAssignee":"urn:li:person:XXX","state":"APPROVED","organizationalTarget":"urn:li:organization:AAA"},
**2**{"role":"ADMINISTRATOR","roleAssignee":"urn:li:person:XXX","state":"APPROVED","organizationalTarget":"urn:li:organization:ZZZZ"},
**3**{"role":"ADMINISTRATOR","roleAssignee":"urn:li:person:XXX","state":"APPROVED","organizationalTarget":"urn:li:organization:TTTT"}],
....
....
....
**20**{"role":"ADMINISTRATOR","roleAssignee":"urn:li:person:XXX","state":"APPROVED","organizationalTarget":"urn:li:organization:zzzTT"}]
...
...
..
**30**{"role":"ADMINISTRATOR","roleAssignee":"urn:li:person:XXX","state":"APPROVED","organizationalTarget":"urn:li:organization:zzzTT"}]
"paging":{"**count":10,"start":10**,"links":[]}}}
//回复结束
它不是从10到20给出结果,而是从0到30恢复所有结果。因此需要知道为什么响应不受限制。
请注意,需要澄清这些问题,提前致谢。
答案 0 :(得分:0)
您可以通过将 paging 放在元素之前
来检索分页 之前
https://api.linkedin.com/v2/organizationalEntityAcls?q=roleAssignee&role=ADMINISTRATOR&projection=(elements*(*,roleAssignee~(localizedFirstName,localizedLastName),organizationalTarget〜(localizedName)))&oauth2_access_token = xxxx;
之后
https://api.linkedin.com/v2/organizationalEntityAcls?q=roleAssignee&role=ADMINISTRATOR&projection=( paging ,elements *(*,roleAssignee〜(localizedFirstName,localizedLastName),organizationalTarget〜(localizedName)))) &oauth2_access_token = xxxx;