【问题标题】:Delta Query for user resource: How to get only changed attributes用户资源的增量查询:如何仅获取更改的属性
【发布时间】:2017-08-11 12:09:46
【问题描述】:

我正在使用 Microsoft Graph API 增量查询来跟踪我的 Azure AD 中的更改。

我只想获取已更改的属性。因此,我将 'ocp-aad-dq-include-only-changed-properties' 标头值设置为 'true' 以仅获取更改的属性。但即使在使用此标头后,我也会收到所有用户属性。

是否有任何其他选项可以仅获取更改的属性?或者我需要使用任何其他标题吗?

下面给出了我正在尝试的操作的详细描述。

例子:

  • 初始 Delta 请求

     GET https://graph.microsoft.com/v1.0/users/delta?$select=displayName,givenName,surname
    

    标题:

     ocp-aad-dq-include-only-changed-properties : true
    

    回应: 在最初的响应中,我得到了所有用户。

  • DeltaLink 请求更新“displayName”属性后

     GET https://graph.microsoft.com/v1.0/users/delta?$deltatoken=KhFiGlAZqewNAThmCVnNxqPu5gOBegrm1CaV
    

    标题:

     ocp-aad-dq-include-only-changed-properties : true
    

    在这里我添加了“ocp-aad-dq-include-only-changed-properties”标头,但我仍然获得了用户的所有属性

    回复:

    {
        "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users",
        "@odata.deltaLink": "https://graph.microsoft.com/v1.0/users/delta?$deltatoken=o8xFasdpZ7QDP14TyDfj9AeibJxMlXAtgB0Nb",
        "value": [
            {
                "businessPhones": [],
                "displayName": "jhon4",
                "givenName": null,
                "jobTitle": null,
                "mail": null,
                "mobilePhone": null,
                "officeLocation": null,
                "preferredLanguage": null,
                "surname": null,
                "userPrincipalName": "jhon.smith@testdomain.onmicrosoft.com",
                "id": "942h93c9-af17-6sad2d98cc8"
            }
        ]
    }
    
  • 更新请求

     PATCH https://graph.microsoft.com/v1.0/users/jhon.smith@testdomain.onmicrosoft.com
    

    有效载荷:

    {
      "displayName": "jhon4",
    }
    

【问题讨论】:

    标签: azure-active-directory microsoft-graph-api change-tracking


    【解决方案1】:

    ocp-aad-dq-include-only-changed-properties 标头是Azure AD Graph API 的一项功能,在Microsoft Graph 中不受支持。

    虽然它们非常相似,但这两个 API 有几个明显的功能差异(例如这个)。您可以在Microsoft Graph or the Azure AD Graph 阅读有关差异(和总体计划)的更多信息。

    【讨论】:

    • 你知道微软什么时候会为 Microsoft Graph API 添加优化标头吗?
    • 恐怕我没有预计到达时间。我建议在 UserVoice 中询问:officespdev.uservoice.com/forums/…
    【解决方案2】:

    要仅获取更改的属性,请使用此标头: 喜欢:return=minimal

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-11-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-09
      相关资源
      最近更新 更多