You're reading "Content Management API"

Scheduled publication

You can create scheduled publication to publish records in the future

The Scheduled publication object

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

Object fields:
publication_scheduled_atstring

The future date for the publication

Create a new scheduled publication

To create a new scheduled publication, send a POST request to the /items/:item_id/scheduled_publication 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/items/:item_id/scheduled_publication HTTP/1.1
X-Api-Version2
AuthorizationBearer YOUR-API-KEY
Acceptapplication/json
Content-Typeapplication/json
{ "data": { "type": "scheduled_publication$", "attributes": { "publication_scheduled_at": "2017-02-10T11:03:42.208Z" } } }
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": "scheduled_publication$", "id": "34", "attributes": { "publication_scheduled_at": "2017-02-10T11:03:42.208Z" }, "relationships": { "item": { "data": { "type": "item", "id": "4235" } } } }, "included": [ { "type": "item", "id": "4235", "attributes": { "title": "My first blog post!", "content": "Lorem ipsum dolor sit amet...", "category": "24", "image": "1235" }, "relationships": { "item_type": { "data": { "type": "item_type", "id": "44" } }, "creator": { "data": { "type": "account", "id": "312" } } }, "meta": { "created_at": "", "updated_at": "", "published_at": null, "first_published_at": null, "publication_scheduled_at": null, "status": null, "is_valid": true } } ] }

Delete a scheduled publication

To delete a scheduled publication, send a DELETE request to the /items/:item_id/scheduled_publication 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/items/:item_id/scheduled_publication 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": "scheduled_publication$", "id": "34", "attributes": { "publication_scheduled_at": "2017-02-10T11:03:42.208Z" }, "relationships": { "item": { "data": { "type": "item", "id": "4235" } } } }, "included": [ { "type": "item", "id": "4235", "attributes": { "title": "My first blog post!", "content": "Lorem ipsum dolor sit amet...", "category": "24", "image": "1235" }, "relationships": { "item_type": { "data": { "type": "item_type", "id": "44" } }, "creator": { "data": { "type": "account", "id": "312" } } }, "meta": { "created_at": "", "updated_at": "", "published_at": null, "first_published_at": null, "publication_scheduled_at": null, "status": null, "is_valid": true } } ] }