Get a menu by reference
const url = 'https://apibase.ecomweb.app/api/v1/public/stores/example/menus/ref/example?include_items=true';const options = {method: 'GET', headers: {'x-storefront-api-key': '<x-storefront-api-key>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url 'https://apibase.ecomweb.app/api/v1/public/stores/example/menus/ref/example?include_items=true' \ --header 'x-storefront-api-key: <x-storefront-api-key>'Returns the menu with the given ref, with its nested items. Link items that point at a product, collection, blog post, blog category or content page carry that record’s slug and description. When no menu has that reference the response is 200 with an empty body.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The menu’s reference, such as header-menu.
The store’s ref, as returned by GET /stores.
Query Parameters
Section titled “Query Parameters”Accepted for compatibility. The menu’s items are returned whatever value is sent.
Responses
Section titled “Responses”The menu, or an empty body when no menu has that reference.
object
When the menu was deleted. Always null on menus you can read.
The menu’s top-level items, each with its nested children. Present only when items are included in the response.
object
ID of the parent item, or null for a top-level item.
What the link points at: product, category, collection, blog_post, blog_category, content_page, search, home, orders, profile or custom. Null for a plain URL.
ID of the referenced record, as a string. Null when the link has no target record.
Slug of the referenced record. Filled in for product, collection, blog_post, blog_category and content_page links; absent otherwise.
URL for external or custom links. Null when the link points at a record.
How the link opens: _self, _blank, _parent or _top.
Description of the referenced record, filled in together with entity_slug.
Item ID.
ID of the menu the item belongs to.
Text shown for the link.
When the item was created, as an ISO 8601 timestamp.
When the item was last updated, as an ISO 8601 timestamp.
Menu ID.
Menu name.
Reference used to look the menu up, unique within the store, such as header-menu.
When the menu was created, as an ISO 8601 timestamp.
When the menu was last updated, as an ISO 8601 timestamp.
Example generated
{ "deleted_at": "example", "menu_items": [ { "parent_id": 1, "entity_type": "example", "entity_id": "example", "entity_slug": "example", "custom_url": "example", "target": "example", "children": [], "description": "example", "id": 1, "menu_id": 1, "label": "example", "created_at": "example", "updated_at": "example" } ], "id": 1, "name": "example", "ref": "example", "created_at": "example", "updated_at": "example"}The key is missing, invalid, revoked or expired.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}The key may not do this: a missing scope, a readonly key, a publishable key on a Store API route, or a disallowed origin.
object
The HTTP status code.
What went wrong; validation failures list one message per problem.
The HTTP status text, such as Bad Request.
object
A stable, machine-readable error code.
A human-readable explanation.
Extra context about the error, when there is any.
object
When the error happened, as an ISO 8601 timestamp.
Example generated
{ "statusCode": 1, "message": [ "example" ], "error": "example"}