You're reading "Content Management API"

Menu Item

In DatoCMS you can organize the different Models present in your administrative area reordering and grouping them, so that their purpose will be more clear to the final editor.

The Menu Item object

A Menu Item 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:
external_urlstring
labelstring

The label of the menu item

This attribute is required
positioninteger

Ordering index

This attribute is required

List all menu items

To list all menu items, send a GET request to the /menu-items 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/menu-items 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": "menu_item", "id": "34", "attributes": { "label": "Posts", "external_url": null, "position": 1 }, "relationships": { "item_type": { "data": { "type": "item_type", "id": "44" } }, "parent": { "data": null }, "children": { "data": [ { "type": "menu_item", "id": "34" } ] } } } ] }

Retrieve a menu item

To retrieve a menu item, send a GET request to the /menu-items/:menu_item_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/menu-items/:menu_item_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": "menu_item", "id": "34", "attributes": { "label": "Posts", "external_url": null, "position": 1 }, "relationships": { "item_type": { "data": { "type": "item_type", "id": "44" } }, "parent": { "data": null }, "children": { "data": [ { "type": "menu_item", "id": "34" } ] } } } }

Create a new menu item

To create a new menu item, send a POST request to the /menu-items 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/menu-items HTTP/1.1
X-Api-Version2
AuthorizationBearer YOUR-API-KEY
Acceptapplication/json
Content-Typeapplication/json
{ "data": { "type": "menu_item", "attributes": { "label": "Posts", "external_url": null, "position": 1 }, "relationships": { "item_type": { "data": { "type": "item_type", "id": "44" } }, "parent": { "data": null } } } }
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": "menu_item", "id": "34", "attributes": { "label": "Posts", "external_url": null, "position": 1 }, "relationships": { "item_type": { "data": { "type": "item_type", "id": "44" } }, "parent": { "data": null }, "children": { "data": [ { "type": "menu_item", "id": "34" } ] } } } }

Update a menu item

To update a menu item, send a PUT request to the /menu-items/:menu_item_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/menu-items/:menu_item_id HTTP/1.1
X-Api-Version2
AuthorizationBearer YOUR-API-KEY
Acceptapplication/json
Content-Typeapplication/json
{ "data": { "type": "menu_item", "id": "34", "attributes": { "label": "Posts", "external_url": null, "position": 1 }, "relationships": { "item_type": { "data": { "type": "item_type", "id": "44" } }, "parent": { "data": null } } } }
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": "menu_item", "id": "34", "attributes": { "label": "Posts", "external_url": null, "position": 1 }, "relationships": { "item_type": { "data": { "type": "item_type", "id": "44" } }, "parent": { "data": null }, "children": { "data": [ { "type": "menu_item", "id": "34" } ] } } } }

Delete a menu item

To delete a menu item, send a DELETE request to the /menu-items/:menu_item_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/menu-items/:menu_item_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": "menu_item", "id": "34", "attributes": { "label": "Posts", "external_url": null, "position": 1 }, "relationships": { "item_type": { "data": { "type": "item_type", "id": "44" } }, "parent": { "data": null }, "children": { "data": [ { "type": "menu_item", "id": "34" } ] } } } }