Sluzby
Ziskani seznamu sluzeb nabizenych projektem.
GET /:slug/services
Vrati seznam vsech aktivnich sluzeb.
Pozadavek
curl -X GET \
-H "X-API-Key: vas_api_klic" \
https://api.zarezervujto.cz/api/v1/vas-projekt/services
Query parametry
| Parametr | Typ | Popis |
|---|---|---|
branchId | string | Filtrovat podle pobocky (volitelne) |
Odpoved
{
"success": true,
"count": 3,
"services": [
{
"id": "service-1",
"name": "Strihani vlasu",
"description": "Klasicky strih pro muze i zeny",
"duration": 30,
"price": 350,
"currency": "CZK",
"branchId": "branch-1",
"isActive": true
},
{
"id": "service-2",
"name": "Barveni",
"description": "Profesionalni barveni vlasu",
"duration": 90,
"price": 1200,
"currency": "CZK",
"branchId": "branch-1",
"isActive": true
}
]
}
Popis poli
| Pole | Typ | Popis |
|---|---|---|
id | string | Unikatni ID sluzby |
name | string | Nazev sluzby |
description | string | null | Popis sluzby |
duration | number | Delka v minutach |
price | number | Cena |
currency | string | Mena (CZK, EUR) |
branchId | string | null | ID pobocky |
isActive | boolean | Zda je sluzba aktivni |
Priklad pouziti
async function getServices(slug, apiKey, branchId = null) {
let url = `https://api.zarezervujto.cz/api/v1/$:slug/services`;
if (branchId) {
url += `?branchId=${branchId}`;
}
const response = await fetch(url, {
headers: { 'X-API-Key': apiKey }
});
const data = await response.json();
return data.services;
}
// Pouziti
const services = await getServices('salon-krasy', 'zrt_live_...');
services.forEach(service => {
console.log(`${service.name} - ${service.price} ${service.currency} (${service.duration} min)`);
});
Filtrovani podle pobocky
curl -X GET \
-H "X-API-Key: vas_api_klic" \
"https://api.zarezervujto.cz/api/v1/vas-projekt/services?branchId=branch-1"