Sorry, no results found for "".

Show examples in:
Javascript HTTP
Endpoint info
Available examples

Content Management API > Menu Item

Update a menu item

Body parameters

type string Required

Must be exactly "menu_item".

attributes.label string Optional

The label of the menu item

Example: "Posts"
attributes.external_url null, string Optional

The URL to which the menu item points to

attributes.position integer Optional

Ordering index

Example: 1
attributes.open_in_new_tab boolean Optional

Opens link in new tab (to be used together with external_url)

relationships.item_type.data Optional

Item type associated with the menu item

relationships.item_type_filter.data Optional

Item type filter associated with the menu item (to be used together with item_type relationship)

relationships.parent.data Optional

Parent menu item

Returns

Returns a resource object of type menu_item.

Examples

PUT https://site-api.datocms.com/menu-items/:menu_item_id HTTP/1.1
Authorization: Bearer YOUR-API-TOKEN
Accept: application/json
X-Api-Version: 3
Content-Type: application/vnd.api+json
{
"data": {
"type": "menu_item",
"id": "uinr2zfqQLeCo_1O0-ao-Q"
}
}
Terminal window
curl -g 'https://site-api.datocms.com/menu-items/:menu_item_id' \
-X PUT \
-H "Authorization: Bearer YOUR-API-TOKEN" \
-H "Accept: application/json" \
-H "X-Api-Version: 3" \
-H "Content-Type: application/vnd.api+json" \
--data-binary '{"data":{"type":"menu_item","id":"uinr2zfqQLeCo_1O0-ao-Q"}}'
await fetch("https://site-api.datocms.com/menu-items/:menu_item_id", {
method: "PUT",
headers: {
Authorization: "Bearer YOUR-API-TOKEN",
Accept: "application/json",
"X-Api-Version": "3",
"Content-Type": "application/vnd.api+json",
},
body: JSON.stringify({
data: { type: "menu_item", id: "uinr2zfqQLeCo_1O0-ao-Q" },
}),
});
HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: cache-control: max-age=0, private, must-revalidate
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 28
{
"data": {
"type": "menu_item",
"id": "uinr2zfqQLeCo_1O0-ao-Q",
"relationships": {
"item_type": {
"data": {
"type": "item_type",
"id": "DxMaW10UQiCmZcuuA-IkkA"
}
},
"item_type_filter": {
"data": {
"type": "item_type_filter",
"id": "FF-P5of6Qp-DD2w0xoaa6Q"
}
},
"parent": {
"data": null
},
"children": {
"data": [
{
"type": "menu_item",
"id": "uinr2zfqQLeCo_1O0-ao-Q"
}
]
}
},
"attributes": {
"label": "Posts",
"position": 1,
"external_url": "",
"open_in_new_tab": true
}
}
}