HTTP/1.1 200
{
"restHooks" : [ {
"id" : 100,
"event" : "party/created",
"targetUrl" : "https://cool.site/partycreatedhook",
"embed" : "fields,tags,owner",
"batched" : true
} ]
}
REST Hooks allow you to subscribe to certain events in Capsule. When those events are triggered, Capsule will send a JSON payload to a URL that you specify, informing you of the change. These endpoints allow you to retrieve, subscribe and unsubscribe hooks. For a full description of the model see the REST Hook model definition.
The collection of REST hooks currently subscribed on the account. If authenticated via a registered application, only REST hooks subscribed by that application will be returned.
Returns HTTP status code 200
. The body of the response will contain an object with a single property restHooks
which is an array of REST Hook objects.
HTTP/1.1 200
{
"restHooks" : [ {
"id" : 100,
"event" : "party/created",
"targetUrl" : "https://cool.site/partycreatedhook",
"embed" : "fields,tags,owner",
"batched" : true
} ]
}
Show a specific REST hook. The REST hook is only visible to users authenticated via the registered application that subscribed it.
Returns HTTP status code 200
. The body of the response will contain an object with a single
property restHook
which will contain a REST Hook object.
HTTP/1.1 200
{
"restHook" : {
"id" : 100,
"event" : "party/created",
"targetUrl" : "https://cool.site/partycreatedhook",
"embed" : "fields,tags,owner",
"batched" : true
}
}
Subscribes to an event in Capsule. A maximum 20 REST hooks can be subscribed per account.
The body must contain an object with a single property restHook
which must be a REST Hook object.
This operation requires that the User has an Administrator role on the account, and is authenticated via a registered application.
{
"restHook" : {
"event" : "party/created",
"targetUrl" : "https://cool.site/partycreatedhook",
"description" : "An amazing hook that will change the world."
}
}
Returns HTTP status code 201
. The body of the response will contain the REST hook as it was stored in Capsule.
HTTP/1.1 201
Location: https://api.capsulecrm.com/api/v2/resthooks/100
{
"restHook" : {
"id" : 100,
"event" : "party/created",
"targetUrl" : "https://cool.site/partycreatedhook",
"embed" : "fields,tags,owner",
"batched" : true
}
}
Name | Type | Description |
---|---|---|
Location | String | The URL that identifies the new REST hook. |
Unsubscribes a REST hook, stopping all events immediately. This operation requires that the user has an Administrator role on the account, and is authenticated via the same registered application that subscribed the REST hook to be deleted.
Returns HTTP status code 204
. Returns an empty body if the REST hook was successfully unsubscribed.
HTTP/1.1 204