The "Get Menu by ID" endpoint allows you to retrieve detailed information about a specific menu, including its items, structure, and metadata. This endpoint is essential for dynamically displaying navigation menus in your application.
The "Get Menu by ID" endpoint allows you to retrieve detailed information about a specific menu, including its items, structure, and metadata. This endpoint is essential for dynamically displaying navigation menus in your application.
GET https://api.justcms.co/public/{projectId}/menus/{id}
Replace {projectId}
with the unique identifier of your project and {id}
with the unique identifier of the menu you wish to retrieve.
Include the following header to authenticate your request:
Authorization: Bearer YOUR_TOKEN
id (string): The unique ID of the menu to retrieve.
200 OK: Returns detailed information about the requested menu.
403 Forbidden: The request was made without a valid or missing authentication token.
404 Not Found: The specified project or menu could not be found.
Here is an example of a request to retrieve a menu by its ID:
GET https://api.justcms.co/public/66d26d17-635e-4206-a1f2-560ae244e9f0/menus/main
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5...
A successful response (200 OK) will return the following JSON:
{
"id": "main",
"name": "Main",
"items": [
{
"title": "API",
"subtitle": "API Documentation",
"icon": "api",
"url": "api",
"styles": [
"bold"
],
"children": []
},
{
"title": "Blog",
"subtitle": "Latest Development",
"icon": "blog",
"url": "blog",
"styles": [],
"children": []
},
{
"title": "About",
"subtitle": "About JustCMS",
"icon": "company",
"url": "about",
"styles": [],
"children": [
{
"title": "Contacts",
"icon": "mail",
"url": "contacts",
"styles": [],
"children": [],
"subtitle": "Contact Us"
},
{
"title": "Support",
"icon": "support",
"url": "support",
"styles": [],
"children": [],
"subtitle": "Support"
}
]
}
]
}
Each menu object contains:
id: The unique identifier of the menu.
name: The display name of the menu.
items: An array of menu items. Each item includes:
title: The display title of the menu item.
subtitle: A short description or subtitle of the menu item.
icon: The icon associated with the menu item.
url: The relative URL for the menu item.
styles: An array of styles associated with the menu item (e.g., bold).
children: An array of sub-items for nested menus.
Dynamic Navigation: Retrieve menus dynamically to display navigation structures in your website or application.
Custom Styling: Use the styles
field to apply custom styles to menu items.
Nested Menus: Handle multi-level menus by processing the children
array for nested items.
403 Forbidden: Ensure that your authentication token is included and valid.
404 Not Found: Verify that the projectId
and id
are correct and exist in your account.