"No HTTP resource was found that matches the request URI 'https://subscriptionstore.windows.net/1.0/subscriptions'.",
"No HTTP resource was found that matches the request URI 'https://subscriptionstore.windows.net/1.0/subscriptions'.",
我正在尝试按照此文档创建 webhook 订阅:https://docs.microsoft.com/en-us/graph/webhooks
但是,当我尝试 POST 到 microsoft graph 时,它给了我这个错误:
"code": "",
"message": "No HTTP resource was found that matches the request URI 'https://subscriptionstore.windows.net/1.0/subscriptions'.",
"innerError":{
"request-id": "10cd5a1d-56a7-44d4-9f4d-51516c7ab69c",
"date": "2019-06-10T10:54:12"
但我没有 POST 那个 URL,我 POST 这个:
https://graph.microsoft.com/v1.0/subscriptions
这是我在 python django-rest
中的代码
outlook_token = settings.outlook_token
request_url = "https://graph.microsoft.com/v1.0/subscriptions"
headers = {"Authorization": f"Bearer {outlook_token}"}
expiration_date = datetime.utcnow() + timedelta(minutes=4000)
print(expiration_date)
expiration_date = expiration_date.strftime("%Y-%m-%dT%H:%M:%SZ")
notification_url = (
"https://9d065f52.ngrok.io/api/v1.0/user-calendar-settings/calendar-webhook"
)
payload = {
"changeType": "created,updated,deleted",
"notificationUrl": notification_url,
"resource": "/me/events",
"expirationDateTime": expiration_date,
"clientState": "SecretClientState",
}
response = requests.patch(url=request_url, headers=headers, json=payload)
抱歉,我做了一个 PATCH 而不是 POST
这就是问题所在。
我正在尝试按照此文档创建 webhook 订阅:https://docs.microsoft.com/en-us/graph/webhooks
但是,当我尝试 POST 到 microsoft graph 时,它给了我这个错误: "code": "", "message": "No HTTP resource was found that matches the request URI 'https://subscriptionstore.windows.net/1.0/subscriptions'.", "innerError":{ "request-id": "10cd5a1d-56a7-44d4-9f4d-51516c7ab69c", "date": "2019-06-10T10:54:12"
但我没有 POST 那个 URL,我 POST 这个: https://graph.microsoft.com/v1.0/subscriptions
这是我在 python django-rest
中的代码outlook_token = settings.outlook_token
request_url = "https://graph.microsoft.com/v1.0/subscriptions"
headers = {"Authorization": f"Bearer {outlook_token}"}
expiration_date = datetime.utcnow() + timedelta(minutes=4000)
print(expiration_date)
expiration_date = expiration_date.strftime("%Y-%m-%dT%H:%M:%SZ")
notification_url = (
"https://9d065f52.ngrok.io/api/v1.0/user-calendar-settings/calendar-webhook"
)
payload = {
"changeType": "created,updated,deleted",
"notificationUrl": notification_url,
"resource": "/me/events",
"expirationDateTime": expiration_date,
"clientState": "SecretClientState",
}
response = requests.patch(url=request_url, headers=headers, json=payload)
抱歉,我做了一个 PATCH 而不是 POST 这就是问题所在。