Sorry, no results found for "".

Show examples in:
Javascript HTTP
Endpoint info
Available examples

Content Management API > Build trigger

Create build trigger

Body parameters

type string Required

Must be exactly "build_trigger".

attributes.name string Required

Name of the build trigger

Example: "Custom build trigger"
attributes.adapter enum Required

The type of build trigger

Example: "custom"
custom Optional

adapter_settings must include the following properties: trigger_url, headers and payload.

netlify Optional

adapter_settings must include the following properties: trigger_url, access_token, branch, site_id

vercel Optional

adapter_settings must include the following properties: project_id, token, branch, team_id, deploy_hook_url

circle_ci Optional

adapter_settings must include the following properties: project, token, revision, vcs, build_parameters

gitlab Optional

adapter_settings must include the following properties: trigger_url, token, ref, build_parameters

travis Optional

adapter_settings must include the following properties: api_token, repo, branch, config

attributes.indexing_enabled boolean Required

Wether Site Search is enabled or not. With Site Search, everytime the website is built, DatoCMS will respider it to get updated content

attributes.frontend_url string, null Required

The public URL of the frontend. If Site Search is enabled (indicated by indexing_enabled), this is the starting point from which the website's spidering will start

Example: "https://www.mywebsite.com/"
attributes.adapter_settings object Required

Additional settings for the build trigger. The value depends on the adapter.

Example: { trigger_url: "http://some-url.com/trigger", headers: { Authorization: "Bearer abc123" }, payload: { type: "build_request" }, }
attributes.autotrigger_on_scheduled_publications boolean Required

Wheter an automatic build request to webhook_url should be made on scheduled publications/unpublishings

attributes.webhook_token string Optional

Unique token for the webhook (it's the same token present in webhook_url)

Example: "xA1239ajsk123"

Returns

Returns a resource object of type build_trigger.

Examples

POST https://site-api.datocms.com/build-triggers HTTP/1.1
Authorization: Bearer YOUR-API-TOKEN
Accept: application/json
X-Api-Version: 3
Content-Type: application/vnd.api+json
{
"data": {
"type": "build_trigger",
"attributes": {
"name": "Custom build trigger",
"adapter": "custom",
"indexing_enabled": true,
"frontend_url": "https://www.mywebsite.com/",
"adapter_settings": {
"trigger_url": "http://some-url.com/trigger",
"headers": {
"Authorization": "Bearer abc123"
},
"payload": {
"type": "build_request"
}
},
"autotrigger_on_scheduled_publications": true
}
}
}
Terminal window
curl -g 'https://site-api.datocms.com/build-triggers' \
-X POST \
-H "Authorization: Bearer YOUR-API-TOKEN" \
-H "Accept: application/json" \
-H "X-Api-Version: 3" \
-H "Content-Type: application/vnd.api+json" \
--data-binary '{"data":{"type":"build_trigger","attributes":{"name":"Custom build trigger","adapter":"custom","indexing_enabled":true,"frontend_url":"https://www.mywebsite.com/","adapter_settings":{"trigger_url":"http://some-url.com/trigger","headers":{"Authorization":"Bearer abc123"},"payload":{"type":"build_request"}},"autotrigger_on_scheduled_publications":true}}}'
await fetch("https://site-api.datocms.com/build-triggers", {
method: "POST",
headers: {
Authorization: "Bearer YOUR-API-TOKEN",
Accept: "application/json",
"X-Api-Version": "3",
"Content-Type": "application/vnd.api+json",
},
body: JSON.stringify({
data: {
type: "build_trigger",
attributes: {
name: "Custom build trigger",
adapter: "custom",
indexing_enabled: true,
frontend_url: "https://www.mywebsite.com/",
adapter_settings: {
trigger_url: "http://some-url.com/trigger",
headers: { Authorization: "Bearer abc123" },
payload: { type: "build_request" },
},
autotrigger_on_scheduled_publications: true,
},
},
}),
});
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: cache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 28
{
"data": {
"type": "build_trigger",
"id": "1822",
"attributes": {
"name": "Custom build trigger",
"adapter": "custom",
"adapter_settings": {
"trigger_url": "http://some-url.com/trigger",
"headers": {
"Authorization": "Bearer abc123"
},
"payload": {
"type": "build_request"
}
},
"last_build_completed_at": "2017-03-30T09:29:14.872Z",
"build_status": "success",
"webhook_url": "https://webhooks.datocoms.com/xA1239ajsk123/deploy-results",
"indexing_status": "success",
"frontend_url": "https://www.mywebsite.com/",
"indexing_enabled": true,
"autotrigger_on_scheduled_publications": true
}
}
}