I'm querying the azure active directory to get the list of the users and one request only fetches 100 records.
In order to get more records I'm making requests on odata.nextLink while it's present.
The problem is:
- It's always present, never null.
- Data gets always fetched.
- Fetched data is duplicated.
Why is this happening ?
Thanks
CodePudding user response:
One of the workarounds is that instead of records we also have an option to get pages-wise. The client can use the $inlinecount query option with the value "allpages" to obtain the total number of items in the return set.
{
"odata.metadata":"http://localhost/$metadata#Products",
"value":[
{ "ID":1,"Name":"Hat","Price":"15","Category":"Apparel" },
{ "ID":2,"Name":"Socks","Price":"5","Category":"Apparel" },
// Others not shown
],
"odata.nextLink":"http://localhost/Products?$inlinecount=allpages"
}
The parameter "allpages" instructs the server to return the whole number of pages:
{
"odata.metadata":"http://localhost/$metadata#Products",
"odata.count":"50",
"value":[
{ "ID":1,"Name":"Hat","Price":"15","Category":"Apparel" },
{ "ID":2,"Name":"Socks","Price":"5","Category":"Apparel" },
// Others not shown
]
}
For more related issues you can refer to Server-Driven Paging.