Microsoft graph, batch request's nextLink

|▌冷眼眸甩不掉的悲伤 提交于 2021-02-08 10:27:21

问题


I'm currently implementing a sync queue service to sync a webapp's customers to Outlook's contacts.

I'm using the Graph API for the job. The creation and updating of contacts is done using graph's batch request.

There's a part in the docs about the response that I don't fully understand and pretty much ignored. I just want to make sure my implementation is correct.

In addition to the responses property, there might be a nextLink property in the batch response. This allows Microsoft Graph to return a batch response as soon as any of the individual requests has completed. To ensure that all individual responses have been received, continue to follow the nextLink as long as it exists.

I was wondering about the following:

  1. when does nextLink show up? I've tried sending different requests but never received it. It's not really clear from the docs but my guess is that it appears when for some reason some of the requests in the batch did not complete in time?

  2. Would the pending requests show up as errors in the response or would they just be missing from it?

  3. Will the nextLink be in form of @odata.nextLink like in pagination requests? It does not specify that in the docs.

  4. How should I handle it when/if it does appear? Can I safely ignore it and just count on the next invocation of service (every 15mins) to retry and sync the pending requests?


回答1:


The paging mechanism mostly applies when you are querying Graph for data.

  1. The nextLink shows up if whatever query you had as part of one of your batch requests requires pagination (just as if you ran the request directly). For example this request as part of your batch job would cause one to appear, provided the targeted user has more than 10 folders:

{ "id":"1", "method":"GET", "url":"users/user@domain.tld/mailFolders" }

  1. The response shows up as normal (with the first page of data included in the response body, along with the nextLink to get to the next page).
  2. Correct. In the above example, the nextLink shows up like this: "@odata.nextLink":"https://graph.microsoft.com/beta/users/user@domain.tld/mailFolders?$skip=10
  3. You will need to follow the nextLink to get the rest of the data.


来源:https://stackoverflow.com/questions/53574745/microsoft-graph-batch-requests-nextlink

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!