Hooks
Use hooks to trigger actions when certain events happen. We currently support only a limited number but can add more. Simply get in touch.
The triggered action runs on a service and so you will need to have at least one service before creating a hook.
You can manage your hooks by making the following requests:
GET /hooks
Example request
shell
curl \
-H "Authorization: Bearer YOUR-API-KEY" \
"https://api.vidbeo.com/v2/hooks"
Example response
json
{
"success": true,
"result": [
{
"id": "abcde12345abcde12345a",
"name": "Copy video to YouTube",
"event": "video.created",
"filters": [],
"filters_logic": "and",
"service": "abcde12345abcde12345a",
"action": "videos.insert",
"params": [],
"created_by": "abcde12345abcde12345a",
"created_time": "2022-01-01T00:00:00.000Z",
"updated_by": "abcde12345abcde12345a",
"updated_time": "2022-01-01T00:00:00.000Z"
}
],
"links": {},
"errors": []
}
Optional parameters (query string)
Name | Type | Default | Information |
---|---|---|---|
limit | String | 25 | Maximum number to return |
cursor | String | "" | Used to get the next page of results: if applicable we return this as part of the links.next URL |
GET /hooks/:id
Example request
shell
curl \
-H "Authorization: Bearer YOUR-API-KEY" \
"https://api.vidbeo.com/v2/hooks/abcde12345abcde12345a"
Example response
json
{
"success": true,
"result": {
"id": "abcde12345abcde12345a",
"name": "Copy video to YouTube",
"event": "video.created",
"filters": [],
"filters_logic": "and",
"service": "abcde12345abcde12345a",
"action": "videos.insert",
"params": [],
"created_by": "abcde12345abcde12345a",
"created_time": "2022-01-01T00:00:00.000Z",
"updated_by": "abcde12345abcde12345a",
"updated_time": "2022-01-01T00:00:00.000Z"
},
"links": null,
"errors": []
}
Response format
Key | Type | Description |
---|---|---|
id | String | The unique identifier given to this hook |
name | String | The name of this hook (a short label for it) |
event | String | The event that triggers the action. We currently only support "video.created" |
filters | Array | An array of objects. If empty, every event will trigger the action. However filters can be used to limit when the action triggers. Each object should be structured like {field: "id", operator:"eq", value: "abcde12345abcde12345a"}. The value of field is one taken from the event data. Contact us if interested in using these |
filters_logic | String | Applicable only when multiple filters have been specified: either "and" or "or" |
service | String | The ID of the service the action will be performed using (see documentation for services) |
action | String | The action that will be triggered using the service. We currently only support "videos.insert" |
params | Array | Any additional data sent along with the action/request: this holds an array of objects like {field: "", value: ""}. The supported fields depends on the action. For example params could be used to store a Mailchimp list ID so that the action knows which marketing list a submitted email address should be added to |
created_by | String | The ID of the user who created it (if known) |
created_time | String | The date and time it was created |
updated_by | String | The ID of the user who last modified it (if known) |
updated_time | String | The date and time it was last modified |
PATCH /hooks/:id
The body of the request should contain one, or more, attributes that you would like to update for the hook.
Example request
shell
curl \
-g \
-H "Authorization: Bearer YOUR-API-KEY" \
-H "Content-Type: application/json" \
-X PATCH \
-d '{"name":"New name"}' \
"https://api.vidbeo.com/v2/hooks/abcde12345abcde12345a"
Example response
json
{
"success": true,
"result": {
"id": "abcde12345abcde12345a",
"name": "New name",
"event": "video.created",
"filters": [],
"filters_logic": "and",
"service": "abcde12345abcde12345a",
"action": "videos.insert",
"params": [],
"created_by": "abcde12345abcde12345a",
"created_time": "2022-01-01T00:00:00.000Z",
"updated_by": "abcde12345abcde12345a",
"updated_time": "2022-01-01T00:00:00.000Z"
},
"links": null,
"errors": []
}
DELETE /hooks/:id
Example request
shell
curl \
-H "Authorization: Bearer YOUR-API-KEY" \
-X DELETE \
"https://api.vidbeo.com/v2/hooks/abcde12345abcde12345a"
Example response
json
{
"success": true,
"result": {},
"links": null,
"errors": []
}
POST /hooks
Required parameters
Its name, an event, a service, and an action to run on that service.
Key | Type | Description |
---|---|---|
name | String | The name of the hook (1-40 characters) |
event | String | The event that triggers the action. We currently only support "video.created" |
service | String | The ID of the service the action will be performed using. See the documentation for services |
action | String | The action that will be triggered using the service. We currently only support "videos.insert" |
Example request
shell
curl \
-g \
-H "Authorization: Bearer YOUR-API-KEY" \
-H "Content-Type: application/json" \
-X POST \
-d '{"name":"Copy video to YouTube","event":"video.created","service":"abcde12345abcde12345a","action":"videos.insert"}' \
"https://api.vidbeo.com/v2/hooks"
Example response
json
{
"success": true,
"result": {
"id": "abcde12345abcde12345a",
"name": "Copy video to YouTube",
"event": "video.created",
"filters": [],
"filters_logic": "and",
"service": "abcde12345abcde12345a",
"action": "videos.insert",
"params": [],
"created_by": "abcde12345abcde12345a",
"created_time": "2022-01-01T00:00:00.000Z",
"updated_by": "abcde12345abcde12345a",
"updated_time": "2022-01-01T00:00:00.000Z"
},
"links": null,
"errors": []
}