天蓝色 API 偏好:return=最小 header

Azure API Prefer: return=minimal header

我遇到了一个 header 叫做 Prefer : return=minimal in Azure API delta calls,我不明白如果我们在做一个增量 API 调用

增量查询使应用程序能够发现新创建、更新或删除的实体,而无需对每个请求执行对目标资源的完整读取。 Microsoft Graph 应用程序可以使用增量查询来有效地将更改与本地数据存储同步。

可选请求 header - prefer:return=minimal - 导致以下行为:

  • 如果 属性 已更改,新值将包含在响应中。这包括设置为空值的属性。
  • 如果 属性 未更改,则 属性 根本不包含在响应中。 (不同于默认行为。)

Example: You are searching for changes made in users using delta and apply a filter $select to get the information of Job title, display name and mobile Number and also add prefer:return=minimal. the response you get is only display name and mobile number which means their values have been changed since the last delta query while the job title hasn't changed.

参考: Return Minimal