You're reading "Content Management API"

Deployment environment

Configuration for different deployment environments. You can have different staging and production environments in order to test your site before final deploy

The Deployment environment object

A Deployment environment object is returned as part of the response body of each successful Index, Show, Create, Update, Delete or Trigger API call. The following table contains the list of all its fields along with their type, description and example values.

Object fields:
build_on_scheduled_publicationsboolean

Deploy on scheduled publication

This attribute is required
deploy_adapterstring

The deploy adapter

This attribute is required
deploy_settingsobject

Additional configuration for deploy

This attribute is required
deploy_statusstring

Status of last deploy

This attribute is required
frontend_urlstring

Public url of the site

last_build_atstring

Timestamp of the last build

last_deploy_atstring

Timestamp of the last deploy

namestring

Name of the environment

This attribute is required
scrape_statusstring

Status of site scraper

This attribute is required
spider_enabledboolean

Enable scraper on the site

This attribute is required
webhook_tokenstring

Unique token of the webhook

This attribute is required
webhook_urlstring

Notification webhook URL

This attribute is required

List all deployment environments for a site

To list all deployment environments for a site, send a GET request to the /deployment-environments endpoint. The following table contains the list of all the possible arguments, along with their type, description and examples values. All the arguments marked as required must be present in the request.

Example request
GET https://site-api.datocms.com/deployment-environments HTTP/1.1
X-Api-Version2
AuthorizationBearer YOUR-API-KEY
Acceptapplication/json
Example response
HTTP/1.1 200 OK
Content-Typeapplication/json; charset=utf-8
Cache-Controlcache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit30
X-RateLimit-Remaining28
{ "data": [ { "type": "deployment_environment", "id": "1822", "attributes": { "name": "Production", "deploy_adapter": "netlify", "deploy_settings": { "trigger_url": "https://api.netlify.com/build_hooks/XXX", "site_id": "XXX", "access_token": "YYY" }, "last_build_at": "2017-03-30T09:29:14.872Z", "last_deploy_at": "2017-03-30T09:29:14.872Z", "deploy_status": "success", "webhook_token": "xA1239ajsk123", "webhook_url": "https://webhooks.datocoms.com/xA1239ajsk123/deploy-results", "scrape_status": "success", "frontend_url": "https://www.mywebsite.com/", "build_on_scheduled_publications": true, "spider_enabled": true } } ] }

Retrieve a deployment environment

To retrieve a deployment environment, send a GET request to the /deployment-environments/:deployment_environment_id endpoint. The following table contains the list of all the possible arguments, along with their type, description and examples values. All the arguments marked as required must be present in the request.

Example request
GET https://site-api.datocms.com/deployment-environments/:deployment_environment_id HTTP/1.1
X-Api-Version2
AuthorizationBearer YOUR-API-KEY
Acceptapplication/json
Example response
HTTP/1.1 200 OK
Content-Typeapplication/json; charset=utf-8
Cache-Controlcache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit30
X-RateLimit-Remaining28
{ "data": { "type": "deployment_environment", "id": "1822", "attributes": { "name": "Production", "deploy_adapter": "netlify", "deploy_settings": { "trigger_url": "https://api.netlify.com/build_hooks/XXX", "site_id": "XXX", "access_token": "YYY" }, "last_build_at": "2017-03-30T09:29:14.872Z", "last_deploy_at": "2017-03-30T09:29:14.872Z", "deploy_status": "success", "webhook_token": "xA1239ajsk123", "webhook_url": "https://webhooks.datocoms.com/xA1239ajsk123/deploy-results", "scrape_status": "success", "frontend_url": "https://www.mywebsite.com/", "build_on_scheduled_publications": true, "spider_enabled": true } } }

Create deployment environment

To create deployment environment, send a POST request to the /deployment-environments endpoint, passing the resource arguments in the request body. The following table contains the list of all the possible arguments, along with their type, description and examples values. All the arguments marked as required must be present in the request.

Example request
POST https://site-api.datocms.com/deployment-environments HTTP/1.1
X-Api-Version2
AuthorizationBearer YOUR-API-KEY
Acceptapplication/json
Content-Typeapplication/json
{ "data": { "type": "deployment_environment", "attributes": { "name": "Production", "webhook_token": "xA1239ajsk123", "deploy_adapter": "netlify", "spider_enabled": true, "frontend_url": "https://www.mywebsite.com/", "build_on_scheduled_publications": true, "deploy_settings": { "trigger_url": "https://api.netlify.com/build_hooks/XXX", "site_id": "XXX", "access_token": "YYY" } } } }
Example response
HTTP/1.1 200 OK
Content-Typeapplication/json; charset=utf-8
Cache-Controlcache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit30
X-RateLimit-Remaining28
{ "data": { "type": "deployment_environment", "id": "1822", "attributes": { "name": "Production", "deploy_adapter": "netlify", "deploy_settings": { "trigger_url": "https://api.netlify.com/build_hooks/XXX", "site_id": "XXX", "access_token": "YYY" }, "last_build_at": "2017-03-30T09:29:14.872Z", "last_deploy_at": "2017-03-30T09:29:14.872Z", "deploy_status": "success", "webhook_token": "xA1239ajsk123", "webhook_url": "https://webhooks.datocoms.com/xA1239ajsk123/deploy-results", "scrape_status": "success", "frontend_url": "https://www.mywebsite.com/", "build_on_scheduled_publications": true, "spider_enabled": true } } }

Update deployment environment

To update deployment environment, send a PUT request to the /deployment-environments/:deployment_environment_id endpoint, passing the resource arguments in the request body. The following table contains the list of all the possible arguments, along with their type, description and examples values. All the arguments marked as required must be present in the request.

Example request
PUT https://site-api.datocms.com/deployment-environments/:deployment_environment_id HTTP/1.1
X-Api-Version2
AuthorizationBearer YOUR-API-KEY
Acceptapplication/json
Content-Typeapplication/json
{ "data": { "type": "deployment_environment", "id": "1822", "attributes": { "name": "Production", "deploy_adapter": "netlify", "spider_enabled": true, "frontend_url": "https://www.mywebsite.com/", "build_on_scheduled_publications": true, "deploy_settings": { "trigger_url": "https://api.netlify.com/build_hooks/XXX", "site_id": "XXX", "access_token": "YYY" } } } }
Example response
HTTP/1.1 200 OK
Content-Typeapplication/json; charset=utf-8
Cache-Controlcache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit30
X-RateLimit-Remaining28
{ "data": { "type": "deployment_environment", "id": "1822", "attributes": { "name": "Production", "deploy_adapter": "netlify", "deploy_settings": { "trigger_url": "https://api.netlify.com/build_hooks/XXX", "site_id": "XXX", "access_token": "YYY" }, "last_build_at": "2017-03-30T09:29:14.872Z", "last_deploy_at": "2017-03-30T09:29:14.872Z", "deploy_status": "success", "webhook_token": "xA1239ajsk123", "webhook_url": "https://webhooks.datocoms.com/xA1239ajsk123/deploy-results", "scrape_status": "success", "frontend_url": "https://www.mywebsite.com/", "build_on_scheduled_publications": true, "spider_enabled": true } } }

Delete a deployment environment

To delete a deployment environment, send a DELETE request to the /deployment-environments/:deployment_environment_id endpoint. The following table contains the list of all the possible arguments, along with their type, description and examples values. All the arguments marked as required must be present in the request.

Example request
DELETE https://site-api.datocms.com/deployment-environments/:deployment_environment_id HTTP/1.1
X-Api-Version2
AuthorizationBearer YOUR-API-KEY
Acceptapplication/json
Example response
HTTP/1.1 200 OK
Content-Typeapplication/json; charset=utf-8
Cache-Controlcache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit30
X-RateLimit-Remaining28
{ "data": { "type": "deployment_environment", "id": "1822", "attributes": { "name": "Production", "deploy_adapter": "netlify", "deploy_settings": { "trigger_url": "https://api.netlify.com/build_hooks/XXX", "site_id": "XXX", "access_token": "YYY" }, "last_build_at": "2017-03-30T09:29:14.872Z", "last_deploy_at": "2017-03-30T09:29:14.872Z", "deploy_status": "success", "webhook_token": "xA1239ajsk123", "webhook_url": "https://webhooks.datocoms.com/xA1239ajsk123/deploy-results", "scrape_status": "success", "frontend_url": "https://www.mywebsite.com/", "build_on_scheduled_publications": true, "spider_enabled": true } } }

Trigger a deploy

To trigger a deploy, send a POST request to the /deployment-environments/:deployment_environment_id/trigger endpoint, passing the resource arguments in the request body. The following table contains the list of all the possible arguments, along with their type, description and examples values. All the arguments marked as required must be present in the request.

Example request
POST https://site-api.datocms.com/deployment-environments/:deployment_environment_id/trigger HTTP/1.1
X-Api-Version2
AuthorizationBearer YOUR-API-KEY
Acceptapplication/json