You're reading "Content Management API"

Editor

A DatoCMS administrative area can be accessed by multiple people. Every editor is linked to a specific Role, which describes what actions it will be able to perform once logged in.

The Editor object

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

Object fields:
emailstring

Email

This attribute is required
first_namestring

First name

This attribute is required
last_namestring

Last name

This attribute is required
statestring

Status of user registration

This attribute is required

List all editors

To list all editors, send a GET request to the /users 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/users 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": "user", "id": "312", "attributes": { "email": "mark.smith@example.com", "first_name": "Mark", "last_name": "Smith", "state": "REGISTERED" }, "relationships": { "role": { "data": { "type": "role", "id": "34" } } } } ] }

Retrieve an editor

To retrieve an editor, send a GET request to the /users/:user_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/users/:user_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": "user", "id": "312", "attributes": { "email": "mark.smith@example.com", "first_name": "Mark", "last_name": "Smith", "state": "REGISTERED" }, "relationships": { "role": { "data": { "type": "role", "id": "34" } } } } }

Invite a new editor

To invite a new editor, send a POST request to the /users 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/users HTTP/1.1
X-Api-Version2
AuthorizationBearer YOUR-API-KEY
Acceptapplication/json
Content-Typeapplication/json
{ "data": { "type": "user", "attributes": { "email": "mark.smith@example.com", "first_name": "Mark", "last_name": "Smith" }, "relationships": { "role": { "data": { "type": "role", "id": "34" } } } } }
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": "user", "id": "312", "attributes": { "email": "mark.smith@example.com", "first_name": "Mark", "last_name": "Smith", "state": "REGISTERED" }, "relationships": { "role": { "data": { "type": "role", "id": "34" } } } } }

Update an editor

To update an editor, send a PUT request to the /users/:user_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/users/:user_id HTTP/1.1
X-Api-Version2
AuthorizationBearer YOUR-API-KEY
Acceptapplication/json
Content-Typeapplication/json
{ "data": { "type": "user", "id": "312", "attributes": { "email": "mark.smith@example.com", "first_name": "Mark", "last_name": "Smith", "password": "supersecret" }, "relationships": { "role": { "data": { "type": "role", "id": "34" } } } } }
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": "user", "id": "312", "attributes": { "email": "mark.smith@example.com", "first_name": "Mark", "last_name": "Smith", "state": "REGISTERED" }, "relationships": { "role": { "data": { "type": "role", "id": "34" } } } } }

Delete an editor

To delete an editor, send a DELETE request to the /users/:user_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/users/:user_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": "user", "id": "312", "attributes": { "email": "mark.smith@example.com", "first_name": "Mark", "last_name": "Smith", "state": "REGISTERED" }, "relationships": { "role": { "data": { "type": "role", "id": "34" } } } } }