Preskočiť na obsah

API – Žiadosti

Cesty sú za https://api.innovanet.com. Hlavička Authorization: Bearer inv_mcp_…. Funkcia innovanet() je v kapitole Rozhranie API.

Polia formulára sa líšia podľa typu žiadosti. Najprv načítajte formuláre a ich polia.

GET /api/requests/forms

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

Odpoveď 200 – data je zoznam formulárov (id, názov). Neznámy formulár na ďalších volaniach vráti 404.

Polia: GET /api/requests/forms/4/inputs. Každé pole má id a type. Hodnoty žiadosti sa posielajú ako objekt, kľúč je id poľa.

Moje žiadosti: 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 áno id poľa → hodnota
price number nie suma, ak ju formulár má

Požiadavka

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

PHP

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

Odpoveď 201

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

Nevyplnené povinné pole vráti 422 a errors. Prílohy polí typu attachment idú ako multipart file_{idPoľa}, nie v JSON.

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

Bez tela.

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

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

Parametre

Pole Typ Povinné
year string nie

API tieto polia číta. Povinnosť platí, keď je v tabuľke áno.

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

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

Parametre

Pole Typ Povinné
year string nie

API tieto polia číta. Povinnosť platí, keď je v tabuľke áno.

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

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

Parametre

Pole Typ Povinné
year string nie

API tieto polia číta. Povinnosť platí, keď je v tabuľke áno.

Odpoveď – Odpoveď je súbor, nie JSON.

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

Parametre

Pole Typ Povinné
year string nie

API tieto polia číta. Povinnosť platí, keď je v tabuľke áno.

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

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

Povolené sú len cesty uložené serverom pri nahraní prílohy tejto žiadosti (<tenant>/requests/…); cesty z klienta sa pri vytvorení žiadosti ignorujú.

Parametre

Pole Typ Povinné
path string nie

API tieto polia číta. Povinnosť platí, keď je v tabuľke áno.

Odpoveď – Odpoveď je súbor, nie JSON.

GET /api/request-forms

Bez tela.

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

GET /api/request-forms/{id}

Bez tela.

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

POST /api/request-forms

Telo

Pole Typ Povinné
name string áno
description string nie
description2 string nie
approver string nie
has_limit string nie
hide_limit boolean nie
boss_approval boolean nie
team_leader_approval boolean nie
boss_perm boolean nie
attachment boolean nie
user_id integer nie
viewers string nie
hr_info boolean nie
order integer nie
{
  "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,
]);

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

PUT /api/request-forms/{id}

Telo

Pole Typ Povinné
name string nie
description string nie
description2 string nie
approver string nie
has_limit string nie
hide_limit boolean nie
boss_approval boolean nie
team_leader_approval boolean nie
boss_perm boolean nie
attachment boolean nie
user_id integer nie
viewers string nie
hr_info boolean nie
order integer nie
{
  "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,
]);

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

DELETE /api/request-forms/{id}

Bez tela.

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

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

Bez tela.

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

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

Telo

Pole Typ Povinné
name string áno
type date áno
required boolean nie
options string nie
visible boolean nie
order integer nie
{
  "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,
]);

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

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

Telo

Pole Typ Povinné
name string nie
type date nie
required boolean nie
options string nie
visible boolean nie
order integer nie
{
  "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,
]);

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

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

Bez tela.

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

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

Parametre

Pole Typ Povinné
year string nie

API tieto polia číta. Povinnosť platí, keď je v tabuľke áno.

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

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

Telo

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

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

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

Telo

Pole Typ Povinné
user_id integer áno
annual_limit number áno
year integer nie
{
  "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,
]);

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

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

Telo

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

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

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

Parametre

Pole Typ Povinné
year string nie

API tieto polia číta. Povinnosť platí, keď je v tabuľke áno.

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


Máte záujem vyskúšať túto funkciu? Aktivujte si innovanet v skúšobnej dobe →