用户增量查询混乱

时间:2019-05-28 02:17:18

标签: microsoft-graph

在v1.0 Microsoft graph API上使用从请求到deltaLink端点的请求中检索到的users/delta时,请执行从每个先前请求返回中返回的后续请求(使用deltaLink)是从初始请求以来更改还是从上一个请求更改?

我对端点的预期方案感到困惑。令牌是长期使用的东西,您在应用程序中使用了一段时间以保持重复使用以跟踪某些初始同步的更改,还是在两个时间点之间查看更改的临时方法,然后丢弃了令牌?

现在看来,自创建令牌以来,似乎“积累”了更改,我认为这是有道理的,但是如果放置很长时间,请求可能会积累很多更改。

1 个答案:

答案 0 :(得分:1)

调用deltaLink时,它将返回自颁发deltaLink令牌以来发生的所有更改。结果还将包含一个 new deltaLink令牌,该令牌用于系统的 next 调查。

换句话说,它类似于Git work之类的源代码控制系统。当您执行git pull时,它将查看本地存储库中的最后一次提交,然后拉出自该提交以来发生的所有更改。在此示例中,Git的提交ID是增量令牌。

例如,您可以使用以下查询“从现在开始”同步用户:

https://graph.microsoft.com/v1.0/users/delta

结果将如下所示:

{
    "@odata.context": "https://graph.microsoft.com/v1.0/$metadata#users",
    "@odata.deltaLink": "https://graph.microsoft.com/v1.0/users/delta?$deltatoken=4Pqov5cPSZPKjBZh-vGbekLcJ2oUTc1kzqA0XhF-lJrEmf3B2i-HyS72r9jBIqHuZUzdMopk5VyHnAI6_qh59FjavhOmaTmQW4JPL2bLKu5LpQ3m_zMSsp6M3Os03KOgaeay0zwAa08QefM1ArkZzkB_pUmZyV6MIS1eN7JHnBOgotBPFyPb-dnjAcheWE9W0HkUR87kf3jsuA4Ja4QTRnN3Hj_4eYdzoYxLWi54Aq2bHWTbDlPtl76M8Bhw8jiq37Y4R-G7G0eZNuRt43CBY0l3XliXXR5Ubi4ZUGApDAGVSPNc_VdHV4H3nbaB5qvwZZ7tAfqZB0-06-ZI-a0y2hxAPJLnI-iTB2PXdqxnaZn4f26k0khW52C57czh9KOjfE3nYV6pwEDFRFu-qj4062eMQwo2H6yoCLysv-C-XIOK3nDTaR3BPDOPGq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nK-R7njc1EoVDejJEDOGyAljhF_kvcxsd_Hu0G8QHi0JtXXm8Tm9hH1O7EtEIDQAHR0tt6ihHixK2IYdfmoe3EIHJ_VmlC37RqTHf2ru2FgkoutuNLII9tYsMhWEEin-tgFwdCvUA0ONHytNY2I0EFKkx56t9JGoupL-lwpnhtnqpnVAPAgAk93D01fBz2NSNlXs_z3E8SOmXud35RNCG62i_nmzHICz_WRwKMHEbqelSst9U2h5FY.uzRUQfIEYUBmAFBUnNWTJn2yfL9toRZ2_VNuoRrA7jg",
    "value": []
}

@odata.delaLink的值是一个URI,指向URI生成的特定时间点Users的状态。如果没有任何变化,并且您遵循@odata.delaLink,您将收到一个空数据集和一个 new URI。如果随后添加新用户,则调用deltaLink仅返回该新用户。