Tags API
De Tags API biedt endpoints voor het beheren van tags in Joomla.
Base URL
/api/index.php/v1/tags
Endpoints Overzicht
| Methode | Endpoint | Beschrijving |
|---|---|---|
| GET | /tags | Alle tags ophalen |
| GET | /tags/{id} | Specifieke tag ophalen |
| POST | /tags | Nieuwe tag aanmaken |
| PATCH | /tags/{id} | Tag bijwerken |
| DELETE | /tags/{id} | Tag verwijderen |
Alle tags ophalen
GET /api/index.php/v1/tags
Response
{
"data": [
{
"type": "tags",
"id": "2",
"attributes": {
"title": "Joomla",
"alias": "joomla",
"description": "Artikelen over Joomla",
"published": 1,
"parent_id": 1,
"level": 1,
"path": "joomla",
"language": "*"
}
}
]
}
Specifieke tag ophalen
GET /api/index.php/v1/tags/{id}
Parameters
| Parameter | Type | Beschrijving |
|---|---|---|
| id | integer | Tag ID |
Voorbeeld
curl -X GET "https://jouwesite.nl/api/index.php/v1/tags/2" \
-H "X-Joomla-Token: JOUW_API_TOKEN"
Tag aanmaken
POST /api/index.php/v1/tags
Request Body
{
"title": "Nieuwe Tag",
"alias": "nieuwe-tag",
"description": "Beschrijving van de tag",
"published": 1,
"access": 1,
"language": "*"
}
Verplichte velden
| Veld | Type | Beschrijving |
|---|---|---|
| title | string | Titel van de tag |
Optionele velden
| Veld | Type | Standaard | Beschrijving |
|---|---|---|---|
| alias | string | auto | URL-vriendelijke naam |
| description | string | "" | Beschrijving |
| parent_id | int | 1 | Parent tag ID |
| published | int | 1 | Publicatiestatus |
| access | int | 1 | Toegangsniveau |
| language | string | "*" | Taalcode of * voor alle |
Voorbeeld
curl -X POST "https://jouwesite.nl/api/index.php/v1/tags" \
-H "X-Joomla-Token: JOUW_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Nieuwe Tag",
"description": "Beschrijving van de tag"
}'
Tag bijwerken
PATCH /api/index.php/v1/tags/{id}
Request Body
{
"title": "Bijgewerkte Tag",
"description": "Nieuwe beschrijving"
}
Voorbeeld
curl -X PATCH "https://jouwesite.nl/api/index.php/v1/tags/2" \
-H "X-Joomla-Token: JOUW_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Bijgewerkte Tag"
}'
Tag verwijderen
DELETE /api/index.php/v1/tags/{id}
Voorbeeld
curl -X DELETE "https://jouwesite.nl/api/index.php/v1/tags/5" \
-H "X-Joomla-Token: JOUW_API_TOKEN"
Let op
Het verwijderen van een tag verplaatst deze naar de prullenbak.
Tag States
| Waarde | Status |
|---|---|
| -2 | Prullenbak |
| 0 | Niet gepubliceerd |
| 1 | Gepubliceerd |
| 2 | Gearchiveerd |
Hiërarchische Tags
Tags ondersteunen een hiërarchische structuur via parent_id.
Voorbeeld: Sub-tag aanmaken
curl -X POST "https://jouwesite.nl/api/index.php/v1/tags" \
-H "X-Joomla-Token: JOUW_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Sub Tag",
"parent_id": 2
}'
Filtering
Op publicatiestatus
GET /api/index.php/v1/tags?filter[published]=1
Zoeken
GET /api/index.php/v1/tags?filter[search]=joomla
Tags koppelen aan content
Tags worden aan artikelen gekoppeld via het tags veld bij het aanmaken of bijwerken van artikelen.
Voorbeeld: Artikel met tags
curl -X POST "https://jouwesite.nl/api/index.php/v1/content/articles" \
-H "X-Joomla-Token: JOUW_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"title": "Artikel met tags",
"catid": 2,
"tags": [2, 3, 5]
}'
Gerelateerde Endpoints
- Articles API - Artikelen met tags