我正在尝试按照本文档创建 webhook 订阅:https ://docs.microsoft.com/en-us/graph/webhooks
但是,当我尝试 POST 到 microsoft graph 时,它给了我这个错误:“code”:“”,“message”:“没有找到与请求 URI 匹配的 HTTP 资源” https://subscriptionstore.windows.net/1.0 /subscriptions '.", "innerError": { "request-id": "10cd5a1d-56a7-44d4-9f4d-51516c7ab69c", "date": "2019-06-10T10:54:12"
但我没有发布到那个 URL,我发布到这个: 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)