Microsoft graph,批处理请求的 nextLink [英] Microsoft graph, batch request's nextLink

查看:39
本文介绍了Microsoft graph,批处理请求的 nextLink的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在实施同步队列服务,以将 Web 应用的客户同步到 Outlook 的联系人.

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

我正在使用 Graph API 来完成这项工作.联系人的创建和更新是使用图的批处理请求完成的.

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.

除了responses属性,可能还有一个nextLink批处理响应中的属性.这允许 Microsoft Graph 返回任何单个请求一有一个批处理响应完全的.为确保收到所有个人回复,只要 nextLink 存在,就继续关注它.

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.

我想知道以下几点:

  1. nextLink 什么时候出现?我尝试发送不同的请求,但从未收到.从文档中看不太清楚,但我的猜测是,由于某种原因,批处理中的某些请求没有及时完成?

  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?

待处理的请求会在响应中显示为错误,还是只是在响应中丢失?

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

nextLink 是否会像分页请求中那样采用 @odata.nextLink 的形式?它没有在文档中指定.

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

当/如果它确实出现时,我应该如何处理它?我可以放心地忽略它,只指望下一次服务调用(每 15 分钟)来重试和同步待处理的请求吗?

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?

推荐答案

分页机制主要应用于Graph查询数据时.

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

  1. 如果您在批处理请求中的任何查询都需要分页(就像您直接运行请求一样),则会显示 nextLink.例如,如果目标用户拥有超过 10 个文件夹,则作为批处理作业一部分的此请求会导致出现一个:

<代码>{"id":"1",方法":获取","url":"users/user@domain.tld/mailFolders"}

  1. 响应正常显示(响应正文中包含第一页数据,以及用于访问下一页的 nextLink).
  2. 正确.在上面的示例中,nextLink 显示如下:"@odata.nextLink":"https://graph.microsoft.com/beta/users/user@domain.tld/mailFolders?$skip=10
  3. 您需要按照 nextLink 获取其余数据.

这篇关于Microsoft graph,批处理请求的 nextLink的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆