我尝试通过点击https://graph.microsoft.com/v1.0/subscriptions https://graph.microsoft.com/beta/subscriptions来订阅onedrive
参数包括:
"changeType": "created,updated,deleted",
"notificationUrl": url.
"resource": "me/drive/root",
"clientState": "client-specific string",
"expirationDateTime": "2018-01-01T11:23:00.000Z",我收到如下错误:
{ error:
{ code: 'InvalidRequest',
message: 'Server could not process subscription creation payload.',
innerError:
{ 'request-id': 'id',
date: '2018-10-16T09:16:46' } } }我正在本地试用。
有什么解决方案吗?
发布于 2021-07-12 10:38:58
确保你发布了一个json请求,这意味着:
如果使用Python,有一个快捷方式:
import requests
url = "https://graph.microsoft.com/beta/subscriptions"
headers = {'Authorization': 'Bearer ' + "YOUR_TOKEN"}
data = {
"changeType": "created,updated,deleted",
"notificationUrl": url.
"resource": "me/drive/root",
"clientState": "client-specific string",
"expirationDateTime": "2018-01-01T11:23:00.000Z"
}
resp = requests.post(headers=headers, json=data)发布于 2019-07-08 21:03:59
我用Postman尝试请求时也遇到了同样的问题。正文为x-www-form-urlencoded格式。当我将正文格式更改为raw并指定JSON时,它可以工作。
Not working "x-www-form-urlencoded" format
看起来MS Graph API只接受某些输入格式。希望这能有所帮助!
https://stackoverflow.com/questions/52832688
复制相似问题