Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pagination in Microsoft Graph APi to get users

I am using graph api to get users of an organization. To implement pagination i used $top parameter which also gave me @odata.nextLink to get next page. No I want previous page when user click on Previous button. I tried using $skip, $previous-page=true parameters but did not work. Links I have used are

  • https://graph.microsoft.com/v1.0/users?$top=10
  • https://graph.microsoft.com/v1.0/users?$skip=10 (tried to redirect to the 2nd page from 4th page but this doesn't work)
  • https://graph.microsoft.com/v1.0/users?$previous-page=true&$top=10 (Only gave 1st 10 users and next link)

Please help me to redirect to previous page.

like image 497
Roshni Gandhi Avatar asked Dec 13 '18 11:12

Roshni Gandhi


People also ask

How do I find my user ID in graph API?

You can get the user information for the signed-in user by replacing /users/{id | userPrincipalName} with /me .

Is graph API deprecated?

Azure Active Directory (Azure AD) Graph is deprecated and will be retired at any time after June 30, 2023, without advance notice, as we announced in September, 2022.


1 Answers

This isn't supported, nor is it what paging was intended for. Pagination is a performance optimization that works by reducing the amount of data transmitted with each call to the API. It is not designed to directly back a UI.

Your app should be pulling down the data as needed and caching it. When the user moves forward, you fetch data from the API. When the user moves backward, you fetch data from your cache.

like image 76
Marc LaFleur Avatar answered Oct 03 '22 20:10

Marc LaFleur