Microsoft Graph API组delta从不返回deltaLink,这会导致无限循环(使用nextLink) [英] Microsoft Graph API groups delta never returns deltaLink, which is causing infinite loop (with nextLink)

查看:122
本文介绍了Microsoft Graph API组delta从不返回deltaLink,这会导致无限循环(使用nextLink)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Microsoft Graph API 我正在使用Delta API进行分组.我为每个组创建一个增量请求(我不跟踪所有组,仅跟踪特定的组).

I'm working with the Microsoft Graph API I'm using the Delta API for groups. I create one delta request per group (I'm not tracking all groups, only specific ones).

我已经检查了此问题并阅读提到的文档.我已经在GitHub 此处

I have checked this question and read the documentation mentioned. And I have read the issue on GitHub here

我正在与同一个租户一起工作,同时利用增量响应发展了几个星期.除了一次,它总是几乎按预期工作.当我发出增量请求时,我得到了nextLink,然后跟随它直到获得deltaLink. 我说这几乎可以按预期工作,因为很多时候,在对数据进行前/后两次响应后,我大部分时间都得到了另外1-3个下一个没有附加数据的链接.

I'm working against the same tenant while developing for few weeks with the delta response. Besides once, it always worked almost as expected. When I made a delta request I got the nextLink, I followed it until I got the deltaLink. I'm saying it almost work as expected, because a lot of times, after the first/two responses with data, I got most of the time another 1-3 next links with no additional data.

我上次尝试使用nextLinks获得约150个响应,直到函数超时为止,除了前几个响应之外,所有这些响应中都没有数据.

The last time I have tried, I got around 150 responses with nextLinks until the function timeout, all of those response besides the first few, had no data in it.

这是一个测试环境,组中有大约30个用户.

This is a testing environment with around 30 users on the group.

我用过

https://graph.microsoft.com/v1.0/groups/delta?$select=id,displayName,members&$filter=id eq 'groupId'`

在无限循环中,这些是我得到的响应

In the infinite loop those are the kind of responses I get

{
   "id":"402-xxx-ee0",
   "status":200,
   "headers":{
      "Preference-Applied":"odata.track-changes",
      "Cache-Control":"no-cache",
      "OData-Version":"4.0",
      "Content-Type":"application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8"
   },
   "body":{
      "@odata.context":"https://graph.microsoft.com/v1.0/$metadata#groups",
      "@odata.nextLink":"https://graph.microsoft.com/v1.0/groups/delta?$skiptoken=5ZZ_<long_token>_OXWrtiE",
      "value":[

      ]
   }
}

您可以看到它们的值中没有数据,但是我仍然得到nextLink 当我关注下一个链接时,我会得到

As you can see their is no data in the value, but still I get nextLink When I'm following this next link I'm getting

{
   "id":"402-xxx-ee0",
   "status":200,
   "headers":{
      "Preference-Applied":"odata.track-changes",
      "Cache-Control":"no-cache",
      "OData-Version":"4.0",
      "Content-Type":"application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false;charset=utf-8"
   },
   "body":{
      "@odata.context":"https://graph.microsoft.com/v1.0/$metadata#groups",
      "@odata.nextLink":"https://graph.microsoft.com/v1.0/groups/delta?$skiptoken=5ZZ_<long_token>_DNF5rRE0",
      "value":[

      ]
   }
}

如您所见,另一个响应以及另一个下一个链接(一个不同的链接)再次返回空值.

As you can see, another response, with another next link (a different one) which again return empty value.

再次发生这种情况,直到我的功能超时为止.

This happens again an again until my function timed out.

我希望在没有更多数据的第一个响应之前获得deltaLink,或者在第一个空响应时获得最大值.

I'm expecting to get the deltaLink before at the first response with no more data, or at the maximum at the first empty response.

推荐答案

以空数组作为值和nextlink的响应是身份实体(用户,组,应用程序,服务主体)的delta函数的正常行为. .)表明并非所有更改都已被枚举,并且更改正在后端进行复制.

Responses with an empty array as the value and a nextlink are a normal behavior of the delta function for identity entities (users, groups, applications, service principals...) indicating that not all changes have been enumerated and replication of changes is happening in the backend.

无论何时出现这种情况(空数组+下一个链接),您的应用程序都应在查询下一个链接之前暂停,为复制提供时间,并避免无限循环.

Whenever you are presented with this situation (empty array + next link), your application should pause before querying the nextlink, giving time for replication to happen and avoiding an infinite loop.

如果您在正常情况下经常看到此行为,则应与支持人员联系.

If you see this behavior happening too often under normal conditions you should contact support.

这篇关于Microsoft Graph API组delta从不返回deltaLink,这会导致无限循环(使用nextLink)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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