API – Firemné podstránky¶
Cesty sú za https://api.innovanet.com. Hlavička Authorization: Bearer inv_mcp_…. Funkcia innovanet() je v kapitole Rozhranie API.
Zápis podstránky vyžaduje oprávnenie na zápis. Čítanie stačí s prihlásením.
GET /api/pages¶
| Parameter | Typ | Povinné | Popis |
|---|---|---|---|
limit |
integer | nie | predvolene 20 |
offset |
integer | nie | predvolene 0 |
status |
string | nie | active alebo inactive |
$res = innovanet('GET', '/api/pages?status=active');
Odpoveď 200
{
"success": true,
"data": [
{
"id": 2,
"title": { "sk": "O firme", "cs": "O firmě", "en": "About us" },
"slug": "o-firme",
"status": 1,
"sectionsCount": 3,
"commentsCount": 0
}
],
"pagination": { "total": 1, "limit": 20, "offset": 0 }
}
status 1 je zverejnená, 0 skrytá. Podľa slugu: GET /api/pages/slug/o-firme. Detail: GET /api/pages/2.
POST /api/pages¶
| Pole | Typ | Povinné | Popis |
|---|---|---|---|
title |
objekt | áno | aspoň jeden z sk, cs, en |
content |
objekt | nie | |
slug |
string | nie | ak chýba, vznikne z nadpisu |
status |
integer | nie | 0 alebo 1, predvolene 1 |
Požiadavka
{
"title": { "sk": "O firme", "cs": "O firmě", "en": "About us" },
"status": 1
}
PHP
$res = innovanet('POST', '/api/pages', [
'title' => ['sk' => 'O firme', 'cs' => 'O firmě', 'en' => 'About us'],
'status' => 1,
]);
Odpoveď 200
{ "success": true, "data": { "id": 2, "slug": "o-firme" } }
Bez nadpisu v žiadnom jazyku je 422. Úprava: PUT /api/pages/2. Komentár: POST /api/pages/2/comments s poľom comment.
Ostatné cesty¶
Každá cesta nižšie je súčasťou tohto modulu. Názvy polí sú tie, ktoré API číta. Súbor na stiahnutie nie je JSON.
GET /api/pages/sidebar¶
Bez tela.
Odpoveď 200 – Obálka { "success": true, "data": ... }.
POST /api/pages/{id}/sections¶
Telo
| Pole | Typ | Povinné |
|---|---|---|
type |
string | nie |
title |
array | nie |
content |
array | nie |
sortOrder |
integer | nie |
{
"type": "text",
"title": [],
"content": [],
"sortOrder": 1
}
$res = innovanet('POST', '/api/pages/1/sections', [
'type' => 'text',
'title' => [],
'content' => [],
'sortOrder' => 1,
]);
Odpoveď 200 – Obálka { "success": true, "data": ... }.
PUT /api/pages/{pageId}/sections/{sectionId}¶
Telo
| Pole | Typ | Povinné |
|---|---|---|
type |
string | nie |
title |
array | nie |
content |
array | nie |
sortOrder |
integer | nie |
{
"type": "text",
"title": [],
"content": [],
"sortOrder": 1
}
$res = innovanet('PUT', '/api/pages/1/sections/1', [
'type' => 'text',
'title' => [],
'content' => [],
'sortOrder' => 1,
]);
Odpoveď 200 – Obálka { "success": true, "data": ... }.
DELETE /api/pages/{pageId}/sections/{sectionId}¶
Bez tela.
Odpoveď 200 – Obálka { "success": true, "data": ... }.
PUT /api/pages/{id}/sections/reorder¶
Telo
| Pole | Typ | Povinné |
|---|---|---|
sections |
array | áno |
{
"sections": []
}
$res = innovanet('PUT', '/api/pages/1/sections/reorder', [
'sections' => [],
]);
Odpoveď 200 – Obálka { "success": true, "data": ... }.
DELETE /api/pages/{pageId}/comments/{commentId}¶
Bez tela.
Odpoveď 200 – Obálka { "success": true, "data": ... }.
Máte záujem vyskúšať túto funkciu? Aktivujte si innovanet v skúšobnej dobe →