Přeskočit obsah

API – Firemní podstránky

Cesty jsou za https://api.innovanet.com. Hlavička Authorization: Bearer inv_mcp_…. Funkce innovanet() je v kapitole Rozhraní API.

Zápis podstránky vyžaduje oprávnění k zápisu. Čtení stačí s přihlášením.

GET /api/pages

Parametr Typ Povinné Popis
limit integer ne výchozí 20
offset integer ne výchozí 0
status string ne active nebo inactive
$res = innovanet('GET', '/api/pages?status=active');

Odpověď 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 zveřejněná, 0 skrytá. Podle slugu: GET /api/pages/slug/o-firme. Detail: GET /api/pages/2.

POST /api/pages

Pole Typ Povinné Popis
title objekt ano alespoň jeden z sk, cs, en
content objekt ne
slug string ne když chybí, vznikne z nadpisu
status integer ne 0 nebo 1, výchozí 1

Požadavek

{
  "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,
]);

Odpověď 200

{ "success": true, "data": { "id": 2, "slug": "o-firme" } }

Bez nadpisu v žádném jazyce je 422. Úprava: PUT /api/pages/2. Komentář: POST /api/pages/2/comments s polem comment.

Ostatní cesty

Každá cesta níže patří do tohoto modulu. Názvy polí jsou ty, které API čte. Soubor ke stažení není JSON.

GET /api/pages/sidebar

Bez těla.

Odpověď 200 – Obálka { "success": true, "data": ... }.

POST /api/pages/{id}/sections

Tělo

Pole Typ Povinné
type string ne
title array ne
content array ne
sortOrder integer ne
{
  "type": "text",
  "title": [],
  "content": [],
  "sortOrder": 1
}
$res = innovanet('POST', '/api/pages/1/sections', [
    'type' => 'text',
    'title' => [],
    'content' => [],
    'sortOrder' => 1,
]);

Odpověď 200 – Obálka { "success": true, "data": ... }.

PUT /api/pages/{pageId}/sections/{sectionId}

Tělo

Pole Typ Povinné
type string ne
title array ne
content array ne
sortOrder integer ne
{
  "type": "text",
  "title": [],
  "content": [],
  "sortOrder": 1
}
$res = innovanet('PUT', '/api/pages/1/sections/1', [
    'type' => 'text',
    'title' => [],
    'content' => [],
    'sortOrder' => 1,
]);

Odpověď 200 – Obálka { "success": true, "data": ... }.

DELETE /api/pages/{pageId}/sections/{sectionId}

Bez těla.

Odpověď 200 – Obálka { "success": true, "data": ... }.

PUT /api/pages/{id}/sections/reorder

Tělo

Pole Typ Povinné
sections array ano
{
  "sections": []
}
$res = innovanet('PUT', '/api/pages/1/sections/reorder', [
    'sections' => [],
]);

Odpověď 200 – Obálka { "success": true, "data": ... }.

DELETE /api/pages/{pageId}/comments/{commentId}

Bez těla.

Odpověď 200 – Obálka { "success": true, "data": ... }.


Máte zájem vyzkoušet tuto funkci? Aktivujte si innovanet v zkušební době →