Ga naar hoofdinhoud

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

MethodeEndpointBeschrijving
GET/content/categoriesAlle categorieën ophalen
GET/content/categories/{id}Specifieke categorie ophalen
POST/content/categoriesNieuwe 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

ParameterTypeBeschrijving
idintegerCategorie 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

VeldTypeBeschrijving
titlestringTitel van de categorie

Optionele velden

VeldTypeStandaardBeschrijving
aliasstringautoURL-vriendelijke naam
descriptionstring""Beschrijving
parent_idint1Parent categorie ID
publishedint1Publicatiestatus
accessint1Toegangsniveau
languagestring"*"Taalcode of * voor alle
extensionstring"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

WaardeStatus
-2Prullenbak
0Niet gepubliceerd
1Gepubliceerd
2Gearchiveerd

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