You're reading "Content Management API"

Invitation

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

The Invitation object

A Invitation 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

List all invitations

To list all invitations, send a GET request to the /site-invitations 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/site-invitations 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": "site_invitation", "id": "312", "attributes": { "email": "mark.smith@example.com" }, "relationships": { "role": { "data": { "type": "role", "id": "34" } } } } ] }

Retrieve an invitation

To retrieve an invitation, send a GET request to the /site-invitations/:site_invitation_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/site-invitations/:site_invitation_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": "site_invitation", "id": "312", "attributes": { "email": "mark.smith@example.com" }, "relationships": { "role": { "data": { "type": "role", "id": "34" } } } } }

Invite a new user

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

Update an invitation

To update an invitation, send a PUT request to the /site-invitations/:site_invitation_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/site-invitations/:site_invitation_id HTTP/1.1
X-Api-Version2
AuthorizationBearer YOUR-API-KEY
Acceptapplication/json
Content-Typeapplication/json
{ "data": { "type": "site_invitation", "id": "312", "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": "site_invitation", "id": "312", "attributes": { "email": "mark.smith@example.com" }, "relationships": { "role": { "data": { "type": "role", "id": "34" } } } } }

Delete an invitation

To delete an invitation, send a DELETE request to the /site-invitations/:site_invitation_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/site-invitations/:site_invitation_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": "site_invitation", "id": "312", "attributes": { "email": "mark.smith@example.com" }, "relationships": { "role": { "data": { "type": "role", "id": "34" } } } } }
Go ahead to: Role