Menus API
De Menus API biedt endpoints voor het beheren van menu's en menu-items in Joomla.
Base URL
/api/index.php/v1/menus
Endpoints Overzicht
Menu Types
| Methode | Endpoint | Beschrijving |
|---|---|---|
| GET | /menus/site | Alle site menu's ophalen |
| GET | /menus/site/{id} | Specifiek menu ophalen |
| POST | /menus/site | Nieuw menu aanmaken |
| PATCH | /menus/site/{id} | Menu bijwerken |
| DELETE | /menus/site/{id} | Menu verwijderen |
Menu Items
| Methode | Endpoint | Beschrijving |
|---|---|---|
| GET | /menus/site/items | Alle menu-items ophalen |
| GET | /menus/site/items/{id} | Specifiek menu-item ophalen |
| POST | /menus/site/items | Nieuw menu-item aanmaken |
| PATCH | /menus/site/items/{id} | Menu-item bijwerken |
| DELETE | /menus/site/items/{id} | Menu-item verwijderen |
Menu Types
Alle menu's ophalen
GET /api/index.php/v1/menus/site
Response
{
"data": [
{
"type": "menus",
"id": "1",
"attributes": {
"menutype": "mainmenu",
"title": "Hoofdmenu",
"description": "Het hoofdmenu van de site"
}
}
]
}
Menu aanmaken
POST /api/index.php/v1/menus/site
Request Body
{
"menutype": "footermenu",
"title": "Footer Menu",
"description": "Menu items in de footer"
}
Verplichte velden
| Veld | Type | Beschrijving |
|---|---|---|
| menutype | string | Unieke identifier voor het menu |
| title | string | Titel van het menu |
Voorbeeld
curl -X POST "https://jouwesite.nl/api/index.php/v1/menus/site" \
-H "X-Joomla-Token: JOUW_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"menutype": "footermenu",
"title": "Footer Menu"
}'
Menu Items
Alle menu-items ophalen
GET /api/index.php/v1/menus/site/items
Response
{
"data": [
{
"type": "menu-items",
"id": "101",
"attributes": {
"title": "Home",
"alias": "home",
"menutype": "mainmenu",
"type": "component",
"link": "index.php?option=com_content&view=featured",
"published": 1,
"parent_id": 1,
"level": 1,
"component_id": 22,
"language": "*"
}
}
]
}
Menu-item aanmaken
POST /api/index.php/v1/menus/site/items
Request Body voor artikel link
{
"title": "Over Ons",
"alias": "over-ons",
"menutype": "mainmenu",
"type": "component",
"link": "index.php?option=com_content&view=article&id=1",
"parent_id": 1,
"published": 1,
"access": 1,
"language": "*"
}
Request Body voor externe URL
{
"title": "Externe Link",
"alias": "externe-link",
"menutype": "mainmenu",
"type": "url",
"link": "https://example.com",
"parent_id": 1,
"published": 1
}
Request Body voor separator
{
"title": "---",
"menutype": "mainmenu",
"type": "separator",
"parent_id": 1
}
Verplichte velden
| Veld | Type | Beschrijving |
|---|---|---|
| title | string | Titel van het menu-item |
| menutype | string | Menu waar item bij hoort |
| type | string | Type (component/url/separator) |
| link | string | Link URL (behalve separator) |
Optionele velden
| Veld | Type | Standaard | Beschrijving |
|---|---|---|---|
| alias | string | auto | URL-vriendelijke naam |
| parent_id | int | 1 | Parent menu-item ID |
| published | int | 1 | Publicatiestatus |
| access | int | 1 | Toegangsniveau |
| language | string | "*" | Taalcode |
| browserNav | int | 0 | Open in: 0=zelfde, 1=nieuw |
Voorbeeld
curl -X POST "https://jouwesite.nl/api/index.php/v1/menus/site/items" \
-H "X-Joomla-Token: JOUW_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Contact",
"alias": "contact",
"menutype": "mainmenu",
"type": "component",
"link": "index.php?option=com_contact&view=contact&id=1",
"published": 1
}'
Menu-item bijwerken
PATCH /api/index.php/v1/menus/site/items/{id}
Voorbeeld
curl -X PATCH "https://jouwesite.nl/api/index.php/v1/menus/site/items/101" \
-H "X-Joomla-Token: JOUW_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Nieuwe Titel",
"published": 0
}'
Menu-item verwijderen
DELETE /api/index.php/v1/menus/site/items/{id}
Menu Item Types
| Type | Beschrijving |
|---|---|
| component | Link naar Joomla component |
| url | Externe of interne URL |
| alias | Alias naar ander menu-item |
| separator | Scheidingslijn |
| heading | Koptekst (niet klikbaar) |
Veelgebruikte Link Formaten
Artikel
index.php?option=com_content&view=article&id={article_id}
Categorie blog
index.php?option=com_content&view=category&layout=blog&id={category_id}
Categorie lijst
index.php?option=com_content&view=category&id={category_id}
Contact
index.php?option=com_contact&view=contact&id={contact_id}
Alle contacten
index.php?option=com_contact&view=categories
Filtering
Op menu type
GET /api/index.php/v1/menus/site/items?filter[menutype]=mainmenu
Op publicatiestatus
GET /api/index.php/v1/menus/site/items?filter[published]=1
Op parent
GET /api/index.php/v1/menus/site/items?filter[parent_id]=1
Submenu Items
Gebruik parent_id om submenu's te maken.
Voorbeeld: Submenu item
curl -X POST "https://jouwesite.nl/api/index.php/v1/menus/site/items" \
-H "X-Joomla-Token: JOUW_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Sub Item",
"menutype": "mainmenu",
"type": "url",
"link": "/sub-pagina",
"parent_id": 101
}'