Contacts API
De Contacts API biedt endpoints voor het beheren van contactpersonen in Joomla.
Base URL
/api/index.php/v1/contact
Endpoints Overzicht
| Methode | Endpoint | Beschrijving |
|---|---|---|
| GET | /contact | Alle contacten ophalen |
| GET | /contact/{id} | Specifiek contact ophalen |
| POST | /contact | Nieuw contact aanmaken |
| PATCH | /contact/{id} | Contact bijwerken |
| DELETE | /contact/{id} | Contact verwijderen |
Alle contacten ophalen
GET /api/index.php/v1/contact
Response
{
"data": [
{
"type": "contacts",
"id": "1",
"attributes": {
"name": "Jan Jansen",
"alias": "jan-jansen",
"con_position": "Manager",
"address": "Hoofdstraat 1",
"suburb": "Amsterdam",
"state": "Noord-Holland",
"country": "Nederland",
"postcode": "1000 AA",
"telephone": "020-1234567",
"mobile": "06-12345678",
"email_to": "jan@example.com",
"webpage": "https://example.com",
"published": 1,
"catid": 4
}
}
]
}
Specifiek contact ophalen
GET /api/index.php/v1/contact/{id}
Parameters
| Parameter | Type | Beschrijving |
|---|---|---|
| id | integer | Contact ID |
Voorbeeld
curl -X GET "https://jouwesite.nl/api/index.php/v1/contact/1" \
-H "X-Joomla-Token: JOUW_API_TOKEN"
Contact aanmaken
POST /api/index.php/v1/contact
Request Body
{
"name": "Piet Pietersen",
"alias": "piet-pietersen",
"con_position": "Directeur",
"address": "Dorpsstraat 10",
"suburb": "Utrecht",
"telephone": "030-9876543",
"mobile": "06-98765432",
"email_to": "piet@example.com",
"webpage": "https://pietersen.nl",
"catid": 4,
"published": 1,
"access": 1,
"language": "*"
}
Verplichte velden
| Veld | Type | Beschrijving |
|---|---|---|
| name | string | Naam van het contact |
| catid | int | Categorie ID |
Optionele velden
| Veld | Type | Standaard | Beschrijving |
|---|---|---|---|
| alias | string | auto | URL-vriendelijke naam |
| con_position | string | "" | Functie/positie |
| address | string | "" | Adres |
| suburb | string | "" | Plaats |
| state | string | "" | Provincie |
| country | string | "" | Land |
| postcode | string | "" | Postcode |
| telephone | string | "" | Telefoonnummer |
| mobile | string | "" | Mobiel nummer |
| fax | string | "" | Faxnummer |
| email_to | string | "" | E-mailadres |
| webpage | string | "" | Website URL |
| published | int | 1 | Publicatiestatus |
| access | int | 1 | Toegangsniveau |
| language | string | "*" | Taalcode |
Voorbeeld
curl -X POST "https://jouwesite.nl/api/index.php/v1/contact" \
-H "X-Joomla-Token: JOUW_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Piet Pietersen",
"email_to": "piet@example.com",
"telephone": "030-9876543",
"catid": 4
}'
Contact bijwerken
PATCH /api/index.php/v1/contact/{id}
Request Body
{
"telephone": "030-1111111",
"email_to": "nieuw@example.com"
}
Voorbeeld
curl -X PATCH "https://jouwesite.nl/api/index.php/v1/contact/1" \
-H "X-Joomla-Token: JOUW_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"telephone": "030-1111111"
}'
Contact verwijderen
DELETE /api/index.php/v1/contact/{id}
Voorbeeld
curl -X DELETE "https://jouwesite.nl/api/index.php/v1/contact/1" \
-H "X-Joomla-Token: JOUW_API_TOKEN"
Contact States
| Waarde | Status |
|---|---|
| -2 | Prullenbak |
| 0 | Niet gepubliceerd |
| 1 | Gepubliceerd |
| 2 | Gearchiveerd |
Contact Categorieën
Contacten worden georganiseerd in categorieën. Standaard is dit categorie ID 4.
Categorieën ophalen
GET /api/index.php/v1/contact/categories
Filtering
Op categorie
GET /api/index.php/v1/contact?filter[catid]=4
Op publicatiestatus
GET /api/index.php/v1/contact?filter[published]=1
Zoeken
GET /api/index.php/v1/contact?filter[search]=jan
Custom Fields
Contacten ondersteunen custom fields. Deze zijn beschikbaar via aparte endpoints:
GET /api/index.php/v1/fields/contact/contact- Contact velden ophalenPOST /api/index.php/v1/fields/contact/contact- Contact veld aanmaken