Skip to main content
GET /api/menu/{code}
The path prefix /api/menu is configurable. Set nowo_dashboard_menu.api.path_prefix in your bundle configuration to change it. The route becomes GET {api.path_prefix}/{code}.

Path parameters

code
string
required
The menu code to load (e.g. sidebar, top-nav). Passed through MenuCodeResolverInterface before use, so the resolved code may differ from the hint depending on your resolver implementation.

Query parameters

_locale
string
Override the request locale used to translate menu item labels. When omitted, the current request locale is used.Examples: en, es, fr
_context_sets
string
JSON-encoded array of context objects. The bundle attempts each context object in order and returns the first menu whose code and context both match. Use {} or null as the last item to fall back to the menu with no context.Example: [{"partnerId":1,"operatorId":1},{"partnerId":1},{}]

Response

Returns an HTTP 200 with a JSON array of root-level menu tree nodes. Returns an empty array when no menu matches the resolved code.

Node structure

label
string
required
Translated label for the resolved locale.
href
string
required
Resolved URL for the item. For Symfony route items this is the generated path; for external items it is the stored URL.
routeName
string | null
required
Symfony route name when the item uses an internal route link type. null for external URL items or section items with no route.
icon
string | null
required
Resolved icon identifier (e.g. bi:house) after icon_library_prefix_map has been applied. null when the item has no icon.
itemType
string
required
Display type of the item. One of:
  • link — a standard clickable link (default)
  • section — a label-only group header with no link
  • divider — a horizontal rule with no label
children
array
required
Recursively nested child nodes with the same structure.

Examples

Basic request

curl 'https://example.com/api/menu/sidebar'

Response

200
[
  {
    "label": "Dashboard",
    "href": "/dashboard",
    "routeName": "app_dashboard",
    "icon": "bi:house",
    "itemType": "link",
    "children": []
  },
  {
    "label": "Reports",
    "href": "/reports",
    "routeName": "app_reports_index",
    "icon": "bi:bar-chart",
    "itemType": "link",
    "children": [
      {
        "label": "Monthly",
        "href": "/reports/monthly",
        "routeName": "app_reports_monthly",
        "icon": null,
        "itemType": "link",
        "children": []
      }
    ]
  }
]

With locale override

cURL
curl 'https://example.com/api/menu/sidebar?_locale=es'

With context sets

Use _context_sets to resolve a context-specific menu variant. The bundle tries each context object in order; the first matching menu is returned.
cURL
curl -G 'https://example.com/api/menu/sidebar' \
  --data-urlencode '_context_sets=[{"partnerId":1,"operatorId":42},{"partnerId":1},{}]'
The _context_sets value must be URL-encoded. The --data-urlencode flag in cURL handles this automatically. In JavaScript, use encodeURIComponent(JSON.stringify(contextSets)).

Empty response when menu not found

When no menu matches the resolved code, the endpoint returns an empty array with HTTP 200.
200
[]