Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
djangocms-rest
djangocms-rest
  • Tutorial
    • Quick Start
    • Installation
    • OpenAPI Documentation
  • How-to Guides
    • Multi-Site setup with single CMS instance
    • Plugin Creation & Serialization
  • API Reference
    • Languages Endpoints
    • Pages Endpoints
    • Placeholders Endpoints
    • Menu Endpoints
    • Submenu Endpoints
    • Breadcrumbs Endpoints
    • Plugins Endpoints
    • Healthcheck Endpoint
  • Contributing
  • Changelog
Back to top
View this page
Edit this page

Submenu Endpoints¶

The Submenu endpoints provide hierarchical submenu structures in django CMS.

Note

The endpoints follow the same structure as the submenu in a template. Please refer to the documentation for more details. Get root level submenu:

{% show_sub_menu 1 %}

GET /api/{language}/submenu/

  • Returns hierarchical submenu structures for the specified language

  • Submenu information includes page titles, URLs, visibility settings, and nested relationships

  • This endpoint is essential for building dropdown menus, sidebar navigation, and contextual menus

  • Advanced endpoints allow filtering by levels, root levels, nephews, and specific paths

CMS Reference¶

  • Menu configuration

  • Navigation and menus

Endpoints¶

List Submenu¶

GET /api/{language}/submenu/

Get the complete submenu structure for a specific language.

Response Attributes:

  • namespace: Application namespace (nullable)

  • title: Menu item title

  • url: Complete URL to the page (nullable)

  • api_endpoint: API endpoint URL for the page (nullable)

  • visible: Whether the menu item is visible

  • selected: Whether the menu item is currently selected

  • attr: Additional attributes (nullable)

  • level: Menu level/depth (nullable)

  • children: Array of child menu items

Path Parameters:

  • language (string, required): Language code (e.g., “en”, “de”)

Query Parameters:

  • preview (boolean, optional): Set to true to preview unpublished content (admin access required)

Example Request:

GET /api/en/submenu/?preview=true

Example Response:

{
    "namespace": null,
    "title": "Home",
    "url": "http://localhost:8080/en/",
    "api_endpoint": "http://localhost:8080/api/en/pages/",
    "visible": true,
    "selected": false,
    "attr": null,
    "level": 0,
    "children": [
        {
            "namespace": null,
            "title": "About Us",
            "url": "http://localhost:8080/en/about/",
            "api_endpoint": "http://localhost:8080/api/en/pages/about/",
            "visible": true,
            "selected": false,
            "attr": null,
            "level": 1,
            "children": []
        }
    ]
}

List Submenu by Levels¶

GET /api/{language}/submenu/{levels}/

Get the submenu structure filtered by number of levels.

Path Parameters:

  • language (string, required): Language code (e.g., “en”, “de”)

  • levels (integer, required): Number of levels to include in the submenu

Query Parameters:

  • preview (boolean, optional): Set to true to preview unpublished content (admin access required)

Example Request:

GET /api/en/submenu/2/?preview=true

Example Response:

{
    "namespace": null,
    "title": "Home",
    "url": "http://localhost:8080/en/",
    "api_endpoint": "http://localhost:8080/api/en/pages/",
    "visible": true,
    "selected": false,
    "attr": null,
    "level": 0,
    "children": [
        {
            "namespace": null,
            "title": "About Us",
            "url": "http://localhost:8080/en/about/",
            "api_endpoint": "http://localhost:8080/api/en/pages/about/",
            "visible": true,
            "selected": false,
            "attr": null,
            "level": 1,
            "children": []
        }
    ]
}

List Submenu by Levels and Path¶

GET /api/{language}/submenu/{levels}/{path}/

Get the submenu structure filtered by number of levels and specific path.

Path Parameters:

  • language (string, required): Language code (e.g., “en”, “de”)

  • levels (integer, required): Number of levels to include in the submenu

  • path (string, required): Path as starting node for the submenu

Query Parameters:

  • preview (boolean, optional): Set to true to preview unpublished content (admin access required)

Example Request:

GET /api/en/submenu/2/about/?preview=true

Example Response:

{
    "namespace": null,
    "title": "About Us",
    "url": "http://localhost:8080/en/about/",
    "api_endpoint": "http://localhost:8080/api/en/pages/about/",
    "visible": true,
    "selected": true,
    "attr": null,
    "level": 1,
    "children": []
}

List Submenu by Levels and Root Level¶

GET /api/{language}/submenu/{levels}/{root_level}/

Get the submenu structure filtered by number of levels and root level.

Path Parameters:

  • language (string, required): Language code (e.g., “en”, “de”)

  • levels (integer, required): Number of levels to include in the submenu

  • root_level (integer, required): Root level to start the submenu from

Query Parameters:

  • preview (boolean, optional): Set to true to preview unpublished content (admin access required)

Example Request:

GET /api/en/submenu/2/1/?preview=true

Example Response:

{
    "namespace": null,
    "title": "About Us",
    "url": "http://localhost:8080/en/about/",
    "api_endpoint": "http://localhost:8080/api/en/pages/about/",
    "visible": true,
    "selected": false,
    "attr": null,
    "level": 1,
    "children": []
}

List Submenu by Levels, Root Level and Nephews¶

GET /api/{language}/submenu/{levels}/{root_level}/{nephews}/

Get the submenu structure filtered by number of levels, root level, and nephews.

Path Parameters:

  • language (string, required): Language code (e.g., “en”, “de”)

  • levels (integer, required): Number of levels to include in the submenu

  • root_level (integer, required): Root level to start the submenu from

  • nephews (integer, required): Number of nephew items to include

Query Parameters:

  • preview (boolean, optional): Set to true to preview unpublished content (admin access required)

Example Request:

GET /api/en/submenu/2/1/1/?preview=true

Example Response:

{
    "namespace": null,
    "title": "About Us",
    "url": "http://localhost:8080/en/about/",
    "api_endpoint": "http://localhost:8080/api/en/pages/about/",
    "visible": true,
    "selected": false,
    "attr": null,
    "level": 1,
    "children": []
}

List Submenu by Levels, Root Level, Nephews and Path¶

GET /api/{language}/submenu/{levels}/{root_level}/{nephews}/{path}/

Get the submenu structure filtered by number of levels, root level, nephews, and specific path.

Path Parameters:

  • language (string, required): Language code (e.g., “en”, “de”)

  • levels (integer, required): Number of levels to include in the submenu

  • root_level (integer, required): Root level to start the submenu from

  • nephews (integer, required): Number of nephew items to include

  • path (string, required): Path as starting node for the submenu

Query Parameters:

  • preview (boolean, optional): Set to true to preview unpublished content (admin access required)

Example Request:

GET /api/en/submenu/2/1/1/about/?preview=true

Example Response:

{
    "namespace": null,
    "title": "About Us",
    "url": "http://localhost:8080/en/about/",
    "api_endpoint": "http://localhost:8080/api/en/pages/about/",
    "visible": true,
    "selected": true,
    "attr": null,
    "level": 1,
    "children": []
}

List Submenu by Levels, Root Level and Path¶

GET /api/{language}/submenu/{levels}/{root_level}/{path}/

Get the submenu structure filtered by number of levels, root level, and specific path.

Path Parameters:

  • language (string, required): Language code (e.g., “en”, “de”)

  • levels (integer, required): Number of levels to include in the submenu

  • root_level (integer, required): Root level to start the submenu from

  • path (string, required): Path as starting node for the submenu

Query Parameters:

  • preview (boolean, optional): Set to true to preview unpublished content (admin access required)

Example Request:

GET /api/en/submenu/2/1/about/?preview=true

Example Response:

{
    "namespace": null,
    "title": "About Us",
    "url": "http://localhost:8080/en/about/",
    "api_endpoint": "http://localhost:8080/api/en/pages/about/",
    "visible": true,
    "selected": true,
    "attr": null,
    "level": 1,
    "children": []
}

List Submenu by Path¶

GET /api/{language}/submenu/{path}/

Get the submenu structure filtered by specific path.

Path Parameters:

  • language (string, required): Language code (e.g., “en”, “de”)

  • path (string, required): Path as starting node for the submenu

Query Parameters:

  • preview (boolean, optional): Set to true to preview unpublished content (admin access required)

Example Request:

GET /api/en/submenu/about/?preview=true

Example Response:

{
    "namespace": null,
    "title": "About Us",
    "url": "http://localhost:8080/en/about/",
    "api_endpoint": "http://localhost:8080/api/en/pages/about/",
    "visible": true,
    "selected": true,
    "attr": null,
    "level": 1,
    "children": []
}
Next
Breadcrumbs Endpoints
Previous
Menu Endpoints
Copyright © 2024, Django CMS Association and contributors
Made with Sphinx and @pradyunsg's Furo
On this page
  • Submenu Endpoints
    • CMS Reference
    • Endpoints
      • List Submenu
      • List Submenu by Levels
      • List Submenu by Levels and Path
      • List Submenu by Levels and Root Level
      • List Submenu by Levels, Root Level and Nephews
      • List Submenu by Levels, Root Level, Nephews and Path
      • List Submenu by Levels, Root Level and Path
      • List Submenu by Path