Show examples in:
Create a new menu item

Body Parameters

id  string  Optional
RFC 4122 UUID of menu item expressed in URL-safe base64 format
label  Required  string  Example: "Posts"

The label of the menu item

external_url  Optional  null, string

The URL to which the menu item points to

position  Optional  integer  Example: 1

Ordering index

open_in_new_tab  Optional  boolean  Example: true

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

item_type  Optional  { type: "item_type", id: item_type.id }, null

Item type associated with the menu item

item_type_filter  Optional  { type: "item_type_filter", id: item_type_filter.id }, null

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

parent  Optional  null, { type: "menu_item", id: menu_item.id }

Parent menu item

Returns

Returns a menu_item resource object.

Examples

Example Basic example
import { buildClient } from '@datocms/cma-client-node';
async function run() {
const client = buildClient({ apiToken: '<YOUR_API_TOKEN>' });
const menuItem = await client.menuItems.create({
label: 'Posts'
});
console.log(menuItem);
}
run();