Azure Rest API“找不到段 'messages?$filter=From' 的资源。”

Azure Rest API " Resource not found for the segment 'messages?$filter=From'. "

我正在尝试访问过去有效的特定文件夹的邮件。由于某种原因传递“?”在 url 中被拒绝为 "illegal character" 在我们的 api 中所以我编码了“?”到“%3F”,最后的 url 看起来像这样:

https://graph.microsoft.com/v1.0/me/MailFolders/INBOX/messages?$filter=From/EmailAddress/Address eq 'alerts-noreply@mail.windowsazure.com'

header 包含以下内容。

("Authorization", "Bearer " + token)
("Content-Type", "application/json")
("Accept", "application/json")
("grant_type", "client_credentials")

如您所见,我正在使用 Azure REST v1 API。我不明白发生了什么。

我收到错误。

{
"error": {
"code": "BadRequest",
"message": "Resource not found for the segment 'messages?$filter=From'.",
"innerError": {
"request-id": "d2e9b359-d40d-4c0a-a0a5-b4e3cf4b5ecd",
"date": "2017-03-24T14:35:28"
}
}
}

感谢您的帮助。

我认为这里的问题是大小写问题。

如果您查看上面复制的查询,您已经大写:

https://graph.microsoft.com/v1.0/me/MailFolders/INBOX/messages?$filter=From/EmailAddress/Address eq 'alerts-noreply@mail.windowsazure.com'

当这 3 个字母都需要小写时(下面的示例来自 our documents):

GET https://graph.microsoft.com/v1.0/me/messages?$filter=from/emailAddress/address eq 'jon@contoso.com'

您不能将 ? 编码为 %3F,这会破坏它。通过这种方式编码,表明它不是查询参数分隔符,因此服务器正在尝试查找名为 messages?$filter=From :).

的段