Přeskočit obsah

API – Žádosti

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

Pole formuláře se liší podle typu žádosti. Nejdřív načtěte formuláře a jejich pole.

GET /api/requests/forms

$res = innovanet('GET', '/api/requests/forms');

Odpověď 200 – data je seznam formulářů (id, název). Neznámý formulář na dalších voláních vrátí 404.

Pole: GET /api/requests/forms/4/inputs. Každé pole má id a type. Hodnoty žádosti se posílají jako objekt, klíč je id pole.

Moje žádosti: GET /api/requests/forms/4/requests?year=2026.

{
  "success": true,
  "data": [
    {
      "id": 18,
      "form_id": 4,
      "date_created": "2026-11-05 11:00:00",
      "price": 120,
      "status": "pending"
    }
  ]
}

Detail: GET /api/requests/requests/18.

POST /api/requests/forms/{formId}/requests

Pole Typ Povinné Popis
values objekt ano id pole → hodnota
price number ne částka, pokud ji formulář má

Požadavek

{
  "values": {
    "12": "Nový monitor",
    "13": "pro grafika"
  },
  "price": 350
}

PHP

$res = innovanet('POST', '/api/requests/forms/4/requests', [
    'values' => [
        '12' => 'Nový monitor',
        '13' => 'pro grafika',
    ],
    'price' => 350,
]);

Odpověď 201

{
  "success": true,
  "message": "Žiadosť bola vytvorená",
  "data": { "id": 18 }
}

Nevyplněné povinné pole vrátí 422 a errors. Přílohy polí typu attachment jdou jako multipart file_{idPole}, ne v JSON.

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/requests/forms/{formId}/years

Bez těla.

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

GET /api/requests/forms/{formId}/limit

Parametry

Pole Typ Povinné
year string ne

API tato pole čte. Povinnost platí, když je v tabulce ano.

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

GET /api/requests/forms/{formId}/limits-overview

Parametry

Pole Typ Povinné
year string ne

API tato pole čte. Povinnost platí, když je v tabulce ano.

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

GET /api/requests/forms/{formId}/requests/managed/export

Parametry

Pole Typ Povinné
year string ne

API tato pole čte. Povinnost platí, když je v tabulce ano.

Odpověď – Odpověď je soubor, ne JSON.

GET /api/requests/forms/{formId}/requests/managed

Parametry

Pole Typ Povinné
year string ne

API tato pole čte. Povinnost platí, když je v tabulce ano.

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

GET /api/requests/requests/{requestId}/attachments/download

Povoleny jsou jen cesty uložené serverem při nahrání přílohy této žádosti (<tenant>/requests/…); cesty z klienta se při vytvoření žádosti ignorují.

Parametry

Pole Typ Povinné
path string ne

API tato pole čte. Povinnost platí, když je v tabulce ano.

Odpověď – Odpověď je soubor, ne JSON.

GET /api/request-forms

Bez těla.

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

GET /api/request-forms/{id}

Bez těla.

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

POST /api/request-forms

Tělo

Pole Typ Povinné
name string ano
description string ne
description2 string ne
approver string ne
has_limit string ne
hide_limit boolean ne
boss_approval boolean ne
team_leader_approval boolean ne
boss_perm boolean ne
attachment boolean ne
user_id integer ne
viewers string ne
hr_info boolean ne
order integer ne
{
  "name": "text",
  "description": "text",
  "description2": "text",
  "approver": "text",
  "has_limit": "text",
  "hide_limit": true,
  "boss_approval": true,
  "team_leader_approval": true,
  "boss_perm": true,
  "attachment": true,
  "user_id": 1,
  "viewers": "text",
  "hr_info": true,
  "order": 1
}
$res = innovanet('POST', '/api/request-forms', [
    'name' => 'text',
    'description' => 'text',
    'description2' => 'text',
    'approver' => 'text',
    'has_limit' => 'text',
    'hide_limit' => true,
    'boss_approval' => true,
    'team_leader_approval' => true,
    'boss_perm' => true,
    'attachment' => true,
    'user_id' => 1,
    'viewers' => 'text',
    'hr_info' => true,
    'order' => 1,
]);

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

PUT /api/request-forms/{id}

Tělo

Pole Typ Povinné
name string ne
description string ne
description2 string ne
approver string ne
has_limit string ne
hide_limit boolean ne
boss_approval boolean ne
team_leader_approval boolean ne
boss_perm boolean ne
attachment boolean ne
user_id integer ne
viewers string ne
hr_info boolean ne
order integer ne
{
  "name": "text",
  "description": "text",
  "description2": "text",
  "approver": "text",
  "has_limit": "text",
  "hide_limit": true,
  "boss_approval": true,
  "team_leader_approval": true,
  "boss_perm": true,
  "attachment": true,
  "user_id": 1,
  "viewers": "text",
  "hr_info": true,
  "order": 1
}
$res = innovanet('PUT', '/api/request-forms/1', [
    'name' => 'text',
    'description' => 'text',
    'description2' => 'text',
    'approver' => 'text',
    'has_limit' => 'text',
    'hide_limit' => true,
    'boss_approval' => true,
    'team_leader_approval' => true,
    'boss_perm' => true,
    'attachment' => true,
    'user_id' => 1,
    'viewers' => 'text',
    'hr_info' => true,
    'order' => 1,
]);

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

DELETE /api/request-forms/{id}

Bez těla.

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

GET /api/request-forms/{id}/inputs

Bez těla.

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

POST /api/request-forms/{id}/inputs

Tělo

Pole Typ Povinné
name string ano
type date ano
required boolean ne
options string ne
visible boolean ne
order integer ne
{
  "name": "text",
  "type": "2026-11-05",
  "required": true,
  "options": "text",
  "visible": true,
  "order": 1
}
$res = innovanet('POST', '/api/request-forms/1/inputs', [
    'name' => 'text',
    'type' => 'text',
    'required' => true,
    'options' => 'text',
    'visible' => true,
    'order' => 1,
]);

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

PUT /api/request-forms/{formId}/inputs/{inputId}

Tělo

Pole Typ Povinné
name string ne
type date ne
required boolean ne
options string ne
visible boolean ne
order integer ne
{
  "name": "text",
  "type": "2026-11-05",
  "required": true,
  "options": "text",
  "visible": true,
  "order": 1
}
$res = innovanet('PUT', '/api/request-forms/1/inputs/1', [
    'name' => 'text',
    'type' => 'text',
    'required' => true,
    'options' => 'text',
    'visible' => true,
    'order' => 1,
]);

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

DELETE /api/request-forms/{formId}/inputs/{inputId}

Bez těla.

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

GET /api/request-forms/{id}/limits

Parametry

Pole Typ Povinné
year string ne

API tato pole čte. Povinnost platí, když je v tabulce ano.

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

PUT /api/request-forms/{id}/limits/group

Tělo

Pole Typ Povinné
annual_limit number ano
{
  "annual_limit": 1
}
$res = innovanet('PUT', '/api/request-forms/1/limits/group', [
    'annual_limit' => 1,
]);

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

POST /api/request-forms/{id}/limits/user

Tělo

Pole Typ Povinné
user_id integer ano
annual_limit number ano
year integer ne
{
  "user_id": 1,
  "annual_limit": 1,
  "year": 1
}
$res = innovanet('POST', '/api/request-forms/1/limits/user', [
    'user_id' => 1,
    'annual_limit' => 1,
    'year' => 1,
]);

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

POST /api/request-forms/{id}/limits/group-user

Tělo

Pole Typ Povinné
user_id integer ano
{
  "user_id": 1
}
$res = innovanet('POST', '/api/request-forms/1/limits/group-user', [
    'user_id' => 1,
]);

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

DELETE /api/request-forms/{id}/limits/user/{userId}

Parametry

Pole Typ Povinné
year string ne

API tato pole čte. Povinnost platí, když je v tabulce ano.

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


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