WebhookSubscriptions

A webhook subscription allows to register webhook urls that get called by the ShareFile Platform when a subscribed to event happens. The webhook call payload contains properties to describe the event E.g. for a File upload event in a Folder: { "WebhookSubscriptionId": "w123", "AccountInfo": { "AccountId": "a123", "Subdomain": "mycompany", "AppControlPlane": "sharefile.com", "ApiControlPlane": "sf-api.com" }, "Event": { "Timestamp": "2000-01-01T20:20:20Z", "OperationName": "Upload", "ResourceType": "File", "Resource": { "Id": "fi123", "Parent": { "Id": "fo123" } } } }

Gets a WebhookSubscription based on id

GET https://account.sf-api.com/sf/v3/WebhookSubscriptions(id) 
idString

Returns: WebhookSubscription

Gets all webhook subscriptions for the current user

GET https://account.sf-api.com/sf/v3/WebhookSubscriptions 

Returns: List of WebhookSubscription

Deletes a WebhookSubscription based on id

DELETE https://account.sf-api.com/sf/v3/WebhookSubscriptions(id) 
idString

Returns:

Creates a WebhookSubscription

POST https://account.sf-api.com/sf/v3/WebhookSubscriptions 
            { 
              "SubscriptionContext": { 
                "ResourceType": "Folder", 
                "ResourceId": "fo123" 
              }, 
              "WebhookUrl": "https://webhook.com", 
              "Events": 
              [ 
                { "ResourceType":"File", "OperationName":"Upload" }, 
                { "ResourceType":"File", "OperationName":"Update" }, 
                { "ResourceType":"File", "OperationName":"Download" }, 
                { "ResourceType":"File", "OperationName":"Delete" }, 
              ] 
            } 

The above example subscribes `https://webhook.com` endpoint to be called when a File Upload, Update, Download or Delete event happened for folder `fo123`. Note: Context Resource Id is required for all but the account context. The MasterAdmin role is required to create account context subscriptions.

Returns: WebhookSubscription