このドキュメントに従って Webhook サブスクリプションを作成しようとしています: https://docs.microsoft.com/en-us/graph/webhooks
ただし、Microsoft Graph に POST しようとすると、次のエラーが表示されます: "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 に投稿しませんでした 。
これは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)