Webhook API v1

From Memsource
Jump to: navigation, search

Create Webhook

action: api2/v1/webhooks
    method                      POST                     // Requires JSON payload in body
    token                       string
    url                         string
    event                       enum(event)              
    hidden                      boolean                  O                    

sample payload: 

{
   "url": "webhook.memsource.com",
   "event": "JOB_STATUS_CHANGED",
   "hidden": "true"
}
 
response: JSON 

{
   "id": 37,
   "hidden": true,
   "event": "JOB_STATUS_CHANGED",
   "url": "webhook.memsource.com"
}

Edit Webhook

action: api2/v1/webhooks/{webHookId}
                                                         // {webHookId} needs to be replaced with the ID of specific webhook
    method                      PUT                      // Requires JSON payload in body
    token                       string
    url                         string                   O
    event                       enum(event)              O
    hidden                      boolean                  O

sample payload: 

{
   "url": "webhook.memsource.com",
   "event": "JOB_ASSIGNED",
   "hidden": "false"
}

response: JSON

{
   "id": 37,
   "hidden": false,
   "event": "JOB_ASSIGNED",
   "url": "webhook.memsource.com"
}

List Webhooks

action: api2/v1/webhooks
    method                      GET
    token                       string

response: JSON

{
   "pageNumber": 0,
   "content": [
       {
           "id": 31,
           "hidden": false,
           "event": "JOB_STATUS_CHANGED",
           "url": "webhook.memsource.com"
       }
   ],
   "numberOfElements": 5,
   "totalElements": 5,
   "pageSize": 50,
   "totalPages": 1
}

Get Webhook

action: api2/v1/webhooks/{webHookId}
                                                         // {webHookId} needs to be replaced with the ID of specific webhook
    method                       GET
    token                        string

response: JSON

{
   "id": 37,
   "hidden": false,
   "event": "JOB_ASSIGNED",
   "url": "webhook.memsource.com"
}

Delete Webhook

action: api2/v1/webhooks/{webHookId}
                                                         // {webHookId} needs to be replaced with the ID of specific webhook
    method                       delete
    token                        string

response: empty