title: Value of resource when subscribing to webhook notifications using graph api
body: <p>I am trying to subscribe to the Microsoft Graph API for webhook notifications to track changes in a folder in a SharePoint Document library. I have app only access to this SharePoint site and am able to see and download all the content within the drive associate with the document library. I can also upload new files using API.</p>
  
  <p>When I make the call to the subscription endpoint I receive an internal server error.</p>
  
  <p>Here is the request I make</p>
  
  <pre><code>curl -X POST \
    https://graph.microsoft.com/v1.0/drive/root/subscriptions \
    -H 'Accept: */*' \
    -H 'Accept-Encoding: gzip, deflate' \
    -H 'Authorization: Bearer TOKEN' \
    -H 'Cache-Control: no-cache' \
    -H 'Connection: keep-alive' \
    -H 'Content-Length: 303' \
    -H 'Content-Type: application/json' \
    -H 'Host: graph.microsoft.com' \
    -d '{
    "changeType": "updated",
    "notificationUrl": "https://c.ngrok.io/sp-hook",
    "resource": "drives/{{DRIVE-ID}}/root",
    "expirationDateTime": "2019-09-18T11:23:00.000",
    "clientState": "test"
  }'
  </code></pre>
  
  <p>Here is the response I get</p>
  
  <pre><code>{
    "error": {
      "code": "InternalServerError",
      "message": "Unable to find target address",
      "innerError": {
        "request-id": "c8e66e50-5b94-4593-88d5-3111e5c5c6c7",
        "date": "2019-09-13T09:50:12"
      }
    }
  }
  </code></pre>
  
  <p>I believe this could be due to a wrong resource value, but I could not locate documentation about what the value of resource should be. I have gone over: <a href="https://docs.microsoft.com/en-us/graph/webhooks" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/graph/webhooks</a> and <a href="https://docs.microsoft.com/en-us/graph/api/resources/webhooks?view=graph-rest-1.0" rel="nofollow noreferrer">https://docs.microsoft.com/en-us/graph/api/resources/webhooks?view=graph-rest-1.0</a>. All the documentation seems to point to a resource value of "me/drives/root", however with app only access a my site is not defined and so the call fails.</p>
  
  <p>These are the different values for resource that I have tried within the request json body</p>
  
  <pre><code>drives('DRIVE-ID')/root
  drives/DRIVE-ID/root
  DRIVE-ID
  drive/DRIVE-ID
  drive/DRIVE-ID/root
  me/drive("DRIVE-ID")/root
  DRIVE-ITEM-ID-FOR-ROOT
  </code></pre>
  
  <p>Different documentation seems to point to different subscription endpoints. These are the different endpoints I have tried
  <a href="https://graph.microsoft.com/v1.0/subscriptions" rel="nofollow noreferrer">https://graph.microsoft.com/v1.0/subscriptions</a>
  <a href="https://graph.microsoft.com/v1.0/drive/root/subscriptions" rel="nofollow noreferrer">https://graph.microsoft.com/v1.0/drive/root/subscriptions</a>
  <a href="https://graph.microsoft.com/beta/drives/" rel="nofollow noreferrer">https://graph.microsoft.com/beta/drives/</a>{{drive-id}}/root/subscriptions</p>
  
  <p>The error also made me suspect that during subscription registration, it was not able to find my webhook. However having tested the endpoint I am sure it is accessible.</p>
  
  <p><em>Additional information</em></p>
  
  <p>I use the following call to get the drive id for a sharepoint site</p>
  
  <pre><code>curl -X GET \
    'https://graph.microsoft.com/v1.0/sites/SITE-ID/drive' \
    -H 'Accept: */*' \
    -H 'Accept-Encoding: gzip, deflate' \
    -H 'Authorization: Bearer TOKEN' \
    -H 'Cache-Control: no-cache' \
    -H 'Connection: keep-alive' \
    -H 'Content-Type: application/json' \
    -H 'Host: graph.microsoft.com' \
  </code></pre>