These endpoints let a tool subscribe a URL to one event (a pattern often called REST hooks). Check the key with GET /me, subscribe, and unsubscribe when the integration is turned off.
Subscribe#
/hooksSubscribing, unsubscribing and sample events all need the key's creator to have developer settings (owners and co-owners have them). Otherwise they answer 403.
| Body property | Rules |
|---|---|
targetUrl | Required, up to 2,000 characters. https on a public host. |
event | Required. object.action, where object is an object slug or *, and action is created, updated, deleted, restored or *. |
description | Optional, up to 200 characters. The default is Added through the API. |
curl --fail-with-body "$JEMERO_URL/hooks" \
-H "Authorization: Bearer $JEMERO_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "targetUrl": "https://example.com/webhooks/jemero", "event": "people.created" }'const response = await fetch(`${process.env.JEMERO_URL}/hooks`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.JEMERO_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
targetUrl: 'https://example.com/webhooks/jemero',
event: 'people.created',
}),
});
if (!response.ok) throw new Error(`${response.status} ${await response.text()}`);
const { id } = await response.json();
console.log(id);import os
import requests
response = requests.post(
f"{os.environ['JEMERO_URL']}/hooks",
headers={"Authorization": f"Bearer {os.environ['JEMERO_API_KEY']}"},
json={
"targetUrl": "https://example.com/webhooks/jemero",
"event": "people.created",
},
timeout=30,
)
response.raise_for_status()
print(response.json()["id"]){ "id": "9798f500-8d92-4623-8782-335e4d89a8c6" }Store the id; you need it to unsubscribe, and there is no endpoint that lists your subscriptions.
Unsubscribe#
/hooks/{id}curl --fail-with-body -X DELETE "$JEMERO_URL/hooks/$HOOK_ID" \
-H "Authorization: Bearer $JEMERO_API_KEY"The answer is 204. An unknown ID, or a webhook that was created in Settings, answers 404 Hook not found.
Revoking an API key deletes the subscriptions it created. An expired key's subscriptions are not deleted: unsubscribe, revoke the key, or delete them in Settings.
Sample events#
/hooks/sampleReturns example events built from the object's three newest records, for tools that need to show sample data while someone sets up a step. Pass event as above.
curl --fail-with-body "$JEMERO_URL/hooks/sample?event=companies.created" \
-H "Authorization: Bearer $JEMERO_API_KEY"The answer is an array in the payload shape, with webhookId set to sample. The date is the time of your request, and there is no changes list, even for updated.
- With object
*, the samples are People. - With action
*, the samples are labelledcreated. - An unknown object, or one with no records, gives
[]. - An invalid
eventanswers400Unknown event.