Search code examples
webhooksonedrive

onedrive for business webhooks


I can't seem to find the correct way to subscribe to webhooks for onedrive for business.

I know the endpoint url is different then regular onedrive. (https://learn.microsoft.com/en-us/onedrive/developer/rest-api/concepts/direct-endpoint-differences)

So according to the docs the endpoint to subscribe to webhooks should be the following:

https://{tenant}-my.sharepoint.com/_api/v2.0/subscriptions

But when I send a POST request to this endpoint I get a 404.

Getting the drive items via this endpoint works as expected. (https://{tenant}-my.sharepoint.com/_api/v2.0//drive/special/approot). Only the "subscriptions" endpoint I can't seem to access.

What am I doing wrong ?


Solution

  • Subscriptions are applied to items, so you'll want:

    https://{tenant}-my.sharepoint.com/_api/v2.0/drive/root/subscriptions
    

    The docs seem a little ambiguous in that regard.