Update subscription

Renew a subscription by extending its expiry time.

Subscriptions expire after a length of time that varies by resource type. In order to avoid missing notifications, an app should renew its subscriptions well in advance of their expiry date. See subscription for maximum length of a subscription for each resource type.

Permissions

The following table lists the suggested permission needed for each resource. To learn more, including how to choose permissions, see Permissions.

Resource type / Item Permission
Contacts Contacts.Read
Conversations Group.Read.All
Events Calendars.Read
Messages Mail.Read
Groups Group.Read.All
Users User.Read.All
Drive (User's OneDrive) Files.ReadWrite
Drives (SharePoint shared content and drives) Files.ReadWrite.All
Security alert SecurityEvents.ReadWrite.All

HTTP request

PATCH /subscriptions/{id}

Request headers

Name Type Description
Authorization string Bearer {token}. Required.

Response

If successful, this method returns a 200 OK response code and subscription object in the response body.

Example

Request

Here is an example of the request.

PATCH https://graph.microsoft.com/v1.0/subscriptions/{id}
Content-type: application/json

{
   "expirationDateTime":"2016-11-22T18:23:45.9356913Z"
}
Response

Here is an example of the response.

HTTP/1.1 200 OK
Content-type: application/json
Content-length: 252

{
  "id":"7f105c7d-2dc5-4530-97cd-4e7ae6534c07",
  "resource":"me/messages",
  "applicationId": "24d3b144-21ae-4080-943f-7067b395b913",
  "changeType":"created,updated",
  "clientState":"subscription-identifier",
  "notificationUrl":"https://webhook.azurewebsites.net/api/send/myNotifyClient",
  "expirationDateTime":"2016-11-22T18:23:45.9356913Z",
  "creatorId": "8ee44408-0679-472c-bc2a-692812af3437"
}