Categories API
De Categories API biedt endpoints voor het beheren van categorieën in Joomla.
Base URL
/api/index.php/v1/content/categories
Endpoints Overzicht
| Methode | Endpoint | Beschrijving |
|---|---|---|
| GET | /content/categories | Alle categorieën ophalen |
| GET | /content/categories/{id} | Specifieke categorie ophalen |
| POST | /content/categories | Nieuwe categorie aanmaken |
| PATCH | /content/categories/{id} | Categorie bijwerken |
| DELETE | /content/categories/{id} | Categorie verwijderen |
Alle categorieën ophalen
GET /api/index.php/v1/content/categories
Response
{
"data": [
{
"type": "categories",
"id": "2",
"attributes": {
"title": "Nieuws",
"alias": "nieuws",
"description": "Nieuwsartikelen",
"published": 1,
"parent_id": 1,
"level": 1,
"path": "nieuws",
"language": "*"
}
}
]
}
Specifieke categorie ophalen
GET /api/index.php/v1/content/categories/{id}
Parameters
| Parameter | Type | Beschrijving |
|---|---|---|
| id | integer | Categorie ID |
Voorbeeld
curl -X GET "https://jouwesite.nl/api/index.php/v1/content/categories/2" \
-H "X-Joomla-Token: JOUW_API_TOKEN"
Categorie aanmaken
POST /api/index.php/v1/content/categories
Request Body
{
"title": "Nieuwe Categorie",
"alias": "nieuwe-categorie",
"description": "Beschrijving van de categorie",
"parent_id": 1,
"published": 1,
"access": 1,
"language": "*"
}
Verplichte velden
| Veld | Type | Beschrijving |
|---|---|---|
| title | string | Titel van de categorie |
Optionele velden
| Veld | Type | Standaard | Beschrijving |
|---|---|---|---|
| alias | string | auto | URL-vriendelijke naam |
| description | string | "" | Beschrijving |
| parent_id | int | 1 | Parent categorie ID |
| published | int | 1 | Publicatiestatus |
| access | int | 1 | Toegangsniveau |
| language | string | "*" | Taalcode of * voor alle |
| extension | string | "com_content" | Component extensie |
Voorbeeld
curl -X POST "https://jouwesite.nl/api/index.php/v1/content/categories" \
-H "X-Joomla-Token: JOUW_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Nieuwe Categorie",
"alias": "nieuwe-categorie",
"parent_id": 1,
"published": 1
}'
Categorie bijwerken
PATCH /api/index.php/v1/content/categories/{id}
Request Body
{
"title": "Bijgewerkte Categorie",
"description": "Nieuwe beschrijving"
}
Voorbeeld
curl -X PATCH "https://jouwesite.nl/api/index.php/v1/content/categories/2" \
-H "X-Joomla-Token: JOUW_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Bijgewerkte Categorie"
}'
Categorie verwijderen
DELETE /api/index.php/v1/content/categories/{id}
Voorbeeld
curl -X DELETE "https://jouwesite.nl/api/index.php/v1/content/categories/5" \
-H "X-Joomla-Token: JOUW_API_TOKEN"
Let op
Een categorie kan alleen verwijderd worden als er geen artikelen aan gekoppeld zijn.
Category States
| Waarde | Status |
|---|---|
| -2 | Prullenbak |
| 0 | Niet gepubliceerd |
| 1 | Gepubliceerd |
| 2 | Gearchiveerd |
Hiërarchie
Categorieën ondersteunen een hiërarchische structuur. Gebruik parent_id om subcategorieën aan te maken.
Voorbeeld: Subcategorie aanmaken
curl -X POST "https://jouwesite.nl/api/index.php/v1/content/categories" \
-H "X-Joomla-Token: JOUW_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Subcategorie",
"parent_id": 2
}'
Filtering
Op parent categorie
GET /api/index.php/v1/content/categories?filter[parent_id]=2
Op publicatiestatus
GET /api/index.php/v1/content/categories?filter[published]=1
Zoeken
GET /api/index.php/v1/content/categories?filter[search]=nieuws
Gerelateerde Endpoints
- Articles API - Artikelen binnen categorieën