Hello Hieu Phan Trung,
Thanks for reaching out!
It is an expected behavior that for MS Graph OneNote API @odata.nextLink is not expected if $top is being used. As it is a client-side paging you should use $skip as needed. Please refer this link for more details about pagination Paging Microsoft Graph data in your app - Microsoft Graph | Microsoft Learn
-
- To get @odata.nextLink you can refer to the below steps:
- To get the first top n results in the response from Graph API, please execute the Graph API in below format.
- https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks?$top=n.
- To get top 3 results in the response the Graph call will be
https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks?$top=3.
- To get @odata.nextLink you can refer to the below steps:
- Now to get the next set of results please use the $skip parameter along with $top.
- $skip-Indexes into a result set.$top-Sets the page size of results.
https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks?$skip=3&$top=3.
- The above Graph call will give the results from count 4 to 6 because we use the skip=3 and top=3.
- Similarly, to get the next set of 3 results
https://graph.microsoft.com/v1.0/users/{user-id}/onenote/notebooks?$skip=7&$top=3
. - This Graph call will return the results from 7 to 9. Please follow the process till last count.
- $skip-Indexes into a result set.$top-Sets the page size of results.
Hope this helps.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have further questions about this answer, please click "Comment".