Webhooks¶
Note: Every endpoint listed in this document is managing JSON objects, so the path structure shown for nested keys is represented in a JSON-style access pattern.
Root Path: /webhooks/
Model¶
Key |
Type |
Default |
Description |
---|---|---|---|
endpoint |
string |
<colander.required> |
The name of an Enfix endpoint. ex: “courses”, “users”, “groups”, “activity_sessions”, etc. |
actions |
string[] |
One or more of: ‘post’, ‘put’, ‘patch’ |
|
send_to |
string |
<colander.required> |
URL to send the webhook request to. |
send_method |
string |
<colander.required> |
One: ‘post’, ‘put’, ‘patch’ |
send_headers |
[]{“key”: “…”, “value”: “…”} |
[] |
Headers attached to each request of the webhook. |
signing_key |
string |
<colander.required> |
Secret that all webhook request bodies will be signed with. |
List¶
Return a list of this collection’s items, matching the filter parameters if provided.
HTTP Verb: GET
Endpoint: /api/v1/webhooks/
Example Request (cURL):
curl -X GET -H "App-Token: [APP_TOKEN]" -H "Token: [TOKEN]"
-H "Content-Type: application/json"
https://<yournamehere>.enfixlp.com/api/v1/webhooks/
Example Response:
[
{
"_id": "5e15fe126cc4e57e33d36217",
"endpoint": "users",
"actions": [],
"send_to": "http://webhook.site/asdf",
"send_method": "post",
"send_headers": [],
"signing_key": "123",
"date_added": "2020-01-08 11:06:42",
"date_updated": "2020-01-08 11:06:42"
}
]
Get One¶
Return the specified collection item.
HTTP Verb: GET
Endpoint: /api/v1/webhooks/[id]
Example Request (cURL):
curl -X GET -H "App-Token: [APP_TOKEN]" -H "Token: [TOKEN]"
-H "Content-Type: application/json"
https://<yournamehere>.enfixlp.com/api/v1/webhooks/[id]
Example Response:
{
"_id": "5e15fe126cc4e57e33d36217",
"endpoint": "users",
"actions": [],
"send_to": "http://webhook.site/asdf",
"send_method": "post",
"send_headers": [],
"signing_key": "123",
"date_added": "2020-01-08 11:06:42",
"date_updated": "2020-01-08 11:06:42"
}
Create¶
Store a new instance of the object in the system. All required fields must be specified.
HTTP Verb: POST
Endpoint: /api/v1/webhooks/
Example Request (cURL):
curl -X POST -H "App-Token: [APP_TOKEN]" -H "Token: [TOKEN]"
-H "Content-Type: application/json"
-d '{"endpoint": "users", "send_to": "http://webhook.site/asdf", "send_method": "post", "signing_key": "123"}'
https://<yournamehere>.enfixlp.com/api/v1/webhooks/
Example Response:
{
"resource_url": "https://<yournamehere>.enfixlp.com/api/v1/webhooks/51b1e78dbd7a844089b652a9/",
"_id": "51b1e78dbd7a844089b652a9"
}
Replace¶
This is a full model replacement of the specified item, every required field must be specified.
HTTP Verb: PUT
Endpoint: /api/v1/webhooks/[id]
Example Request (cURL):
curl -X PUT -H "App-Token: [APP_TOKEN]" -H "Token: [TOKEN]"
-H "Content-Type: application/json"
-d '{"endpoint": "users", "send_to": "http://webhook.site/asdf", "send_method": "post", "signing_key": "123"}'
https://<yournamehere>.enfixlp.com/api/v1/webhooks/[id]
Example Response:
No body, Status Code 204.
Update¶
On an update, you may specify only the fields you wish to update. All other fields will be preserved as currently stored.
HTTP Verb: PATCH
Endpoint: /api/v1/webhooks/[id]
Example Request (cURL):
curl -X PUT -H "App-Token: [APP_TOKEN]" -H "Token: [TOKEN]"
-H "Content-Type: application/json"
-d '{"send_method": "post"}'
https://<yournamehere>.enfixlp.com/api/v1/webhooks/[id]
Example Response:
No body, Status Code 204.
Delete¶
Permanently remove an item from the collection.
HTTP Verb: DELETE
Endpoint: /api/v1/webhooks/[id]
Example Request (cURL):
curl -X DELETE -H "App-Token: [APP_TOKEN]" -H "Token: [TOKEN]"
-H "Content-Type: application/json"
https://<yournamehere>.enfixlp.com/api/v1/webhooks/[id]
Example Response:
No body, Status Code 200.