Code Padawan
Code Padawan

Reputation: 97

Graph API Subscription for New Users

I'm having trouble figuring out the resource and/or change type in order to create a subscription to newly created users. Here's what I have:

    {
      "changeType": "created",
      "notificationUrl": "<someURL.com>",
      "resource": "/users",
      "expirationDateTime": "<todays date + 3>",
      "clientState": "SecretClientState"
    }

I'm getting back the following error:

    {
      "error": {
        "code": "InvalidRequest",
        "message": "Invalid 'changeType' attribute: 'created'.",
        "innerError": {
          "date": "2021-03-12T22:24:06",
          "request-id": "51a191c2-a13e-4c63-a5ca-17923dd783cb",
          "client-request-id": "51a191c2-a13e-4c63-a5ca-17923dd783cb"
        }
      }
    }

Upvotes: 0

Views: 365

Answers (1)

user2250152
user2250152

Reputation: 20725

According to the documentation the correct value of changeType for users resource should be updated.

Note: Drive root item and list change notifications support only the updated changeType. User and group change notifications support updated and deleted changeType.

Also the correct value for resource should be users.

{
  "changeType": "updated",
  "notificationUrl": "<someURL.com>",
  "resource": "users",
  "expirationDateTime": "<todays date + 3>",
  "clientState": "SecretClientState"
}

Subscription resource

Create subscription

Additional notifications for users

Upvotes: 1

Related Questions