This endpoint allows you to list, add or remove subscribers to resthooks.
Listing Resthook Subscribers
A GET
returns the subscribers on your organization. Each resthook subscriber has the following attributes:
- id - the id of the subscriber (integer, filterable).
- resthook - the resthook they are subscribed to (string, filterable).
- target_url - the url that will be notified when this event occurs.
- created_on - when this subscriber was added.
Example:
GET /api/v2/resthook_subscribers.json
Response is the list of resthook subscribers on your organization, most recently created first:
{
"next": "http://example.com/api/v2/resthook_subscribers.json?cursor=cD0yMDE1LTExLTExKzExJTNBM40NjQlMkIwMCUzRv",
"previous": null,
"results": [
{
"id": "10404016"
"resthook": "mother-registration",
"target_url": "https://zapier.com/receive/505019595",
"created_on": "2013-08-19T19:11:21.082Z"
},
{
"id": "10404055",
"resthook": "new-birth",
"target_url": "https://zapier.com/receive/605010501",
"created_on": "2013-08-19T19:11:21.082Z"
},
...
}
Subscribing to a Resthook
By making a POST
request with the event you want to subscribe to and the target URL, you can subscribe to be
notified whenever your resthook event is triggered.
- resthook - the slug of the resthook to subscribe to
- target_url - the URL you want called (will be called with a POST)
Example:
POST /api/v2/resthook_subscribers.json
{
"resthook": "new-report",
"target_url": "https://zapier.com/receive/505019595"
}
Response is the created subscription:
{
"id": "10404016",
"resthook": "new-report",
"target_url": "https://zapier.com/receive/505019595",
"created_on": "2013-08-19T19:11:21.082Z"
}
Deleting a Subscription
A DELETE can be used to delete a subscription if you specify its id in the URL.
Example:
DELETE /api/v2/resthook_subscribers.json?id=10404016
You will receive either a 204 response if a subscriber was deleted, or a 404 response if no matching subscriber was found.