0
votes

Im trying to fetch calendar events using Microsoft graph api.(GET /me/calendar/calendarView?startDateTime={start_datetime}&endDateTime={end_datetime}) an Im getting response JSON (which contains first 10 events) url for the next set of events. Im using retrofit to get these events.

URL for the 1st request

https://graph.microsoft.com/v1.0/me/calendar/calendarView?startDateTime=2021-03-17T00:00:00.788Z&endDateTime=2021-03-19T23:59:00.788Z

and this is url for next of events https://graph.microsoft.com/v1.0/me/calendar/calendarView?startDateTime=2021-03-18T00%3a00%3a00.425Z&endDateTime=2021-03-21T23%3a59%3a00.426Z&%24top=10&%24skip=20

Question here is now how to call th retrofit api in sequential way, every response json have next request url. which I have to use and send new retrofit request.

1
Hi, if the posted answer resolves your question, please mark it as the answer by clicking the check mark. Doing so helps others find answers to their questions. See meta.stackexchange.com/questions/5234/…Shiva Keshav Varma

1 Answers

0
votes

You can simply use the below HTTP call to sequentially get the events based on start datetime.

https://graph.microsoft.com/v1.0/me/calendarView?startDateTime=2020-01-01T19:00:00-08:00&endDateTime=2020-12-12T19:00:00-08:00&$select=id, subject, start, end&$top=100&$orderby=start/dateTime

Here $top can change the number of records per page, its value ranges from 1 to 999, if your records are more than 999 you need to use nextLink to get next set of records which will be in order.

I have used $orderBy to get the records sequentially based on start dateTime.