Overview

REST Menu Items provides a REST endpoint to retrieve menu items by menu name.

Request for example https://example.com/api/menu_items/main?_format=json to get the full menu tree of the main menu as JSON.

This module is useful for decoupled and headless Drupal architectures where a JavaScript front end needs access to Drupal menu structures via a web service.

Features

  • REST endpoint for any Drupal menu: /api/menu_items/{menu_name}
  • Control output depth with max_depth and min_depth query parameters
  • Configurable output values (title, URI, alias, UUID, weight, etc.)
  • Restrict which menus are exposed via the configuration form
  • Supports JSON, HAL+JSON, and XML formats
  • Two alter hooks for customizing the output:
    • hook_rest_menu_items_resource_manipulators_alter — modify menu tree manipulators
    • hook_rest_menu_items_output_alter — modify the output array

Documentation

Questions or feature requests?

If you have any questions or feature requests, please don't hesitate to add them to the issue queue.

🤖 Assisted Development

This module is maintained with the help of AI assistants for code generation, review, testing, and documentation. All code is carefully reviewed by the maintainers to ensure that quality and security standards are met.

Supporting organizations: 
Sponsoring and support

Project information

Releases