错误请求:无效的过滤器子句

Bad Request: Invalid filter clause

我正在使用 POSTMAN 调用 Microsoft Graph APIs。我正在尝试为多个用户订阅在线状态。 document 中提到为了订阅对多个用户存在的更改使用此 url :/communications/presences?$filter=id in ({id},{id}...)

请求Url

https://graph.microsoft.com/beta/subscriptions

所以这是请求正文(原始)

{ 
  "changeType": "updated", 
  "notificationUrl": "https://d3a8ebc3581d.ngrok.io/presence-notify/", 
  "resource": "/communications/presences?$filter=id in (abcd-efgh-4856-a935-c9a2f685xyz,abcd-efgh-47f8-9d79-eacb0fd6xyz)",
  "expirationDateTime": "2020-09-22T07:37:13Z", 
  "clientState": "secretClientState" 
}

我代表用户调用此 API,即我正在使用 UserAccessToken。这是回应:

{
    "error": {
        "code": "BadRequest",
        "message": "Invalid filter clause",
        "innerError": {
            "date": "2020-09-21T16:24:50",
            "request-id": "2cf476f0-2270-417f-a987-5c5bbc92a351",
            "client-request-id": "2cf476f0-2270-417f-a987-5c5bbc92a351"
        }
    }
}

P.S: 我已经更改了两个用户标识的前几个和最后几个字符。所以这不是问题。

我猜这并没有很清楚地记录下来,但是如果您查看 filter 文档。您会看到值实际上需要围绕它们 '

因此,如果您将请求更改为以下内容,它应该会起作用:

{ 
  "changeType": "updated", 
  "notificationUrl": "https://d3a8ebc3581d.ngrok.io/presence-notify/", 
  "resource": "/communications/presences?$filter=id in ('abcd-efgh-4856-a935-c9a2f685xyz','abcd-efgh-47f8-9d79-eacb0fd6xyz')",
  "expirationDateTime": "2020-09-22T07:37:13Z", 
  "clientState": "secretClientState" 
}