Preskočiť na obsah

API – E-learning

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

Správca kurzov volá /api/education/courses. Zamestnanec svoje kurzy na /api/education/my-courses.

GET /api/education/courses

Parameter Typ Povinné Popis
search string nie
categoryId integer nie
includeHidden boolean nie skryté kurzy, len správca
$res = innovanet('GET', '/api/education/courses?search=BOZP');

Odpoveď 200

{
  "success": true,
  "data": [
    {
      "id": 2,
      "title": "BOZP",
      "questionCount": 8,
      "minResult": 80,
      "categoryId": 1,
      "categoryName": "Povinné",
      "hide": 0
    }
  ]
}

Moje kurzy: GET /api/education/my-courses. Kategórie: GET /api/education/categories.

POST /api/education/courses

Pole Typ Povinné Popis
title string áno najviac 500
description string nie
intro string nie
categoryId integer nie
minResult integer nie percentá 0–100, predvolene 80
timeLimitMinutes integer nie
daysToComplete integer nie
onlyOnce integer nie 0 alebo 1
hide integer nie 1 skryje kurz pred bežným zoznamom

PHP

$res = innovanet('POST', '/api/education/courses', [
    'title' => 'BOZP',
    'minResult' => 80,
    'categoryId' => 1,
]);

Odpoveď 201

{
  "success": true,
  "message": "Course was created",
  "data": { "id": 2 }
}

Priradenie ľudí: POST /api/education/courses/2/assign-users. Odovzdanie testu: POST /api/education/courses/2/submit.

{
  "answers": { "1": 2, "2": 1 },
  "startedAt": "2026-11-05T10:00:00"
}

answers je objekt, kľúč je id otázky, hodnota 1, 2 alebo 3. Odpoveď 200 má v data.passed, či test prešiel.

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.

PUT /api/education/categories/{id}

Telo

Pole Typ Povinné
name string nie
{
  "name": "text"
}
$res = innovanet('PUT', '/api/education/categories/1', [
    'name' => 'text',
]);

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

DELETE /api/education/categories/{id}

Bez tela.

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

GET /api/education/courses/{id}/my-attempts

Bez tela.

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

GET /api/education/courses/{id}/stats

Bez tela.

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

POST /api/education/courses/{id}/mark-material-read

Bez tela.

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

GET /api/education/courses/{id}/questions

Bez tela.

Otázky kurzu vidí správca e-learningu, autor kurzu a pridelení používatelia (inak 403). Pole correct (správna odpoveď 1 až 3) dostane iba správca a autor. Kto test rieši, kľúč nedostane: test sa vyhodnocuje na serveri (POST /api/education/courses/{id}/submit) a správne odpovede sa zobrazia až vo výsledku.

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

POST /api/education/courses/{id}/questions

Telo

Pole Typ Povinné
question string áno
image string nie
answer1 string áno
answer2 string áno
answer3 string áno
correct integer áno
{
  "question": "text",
  "image": "text",
  "answer1": "text",
  "answer2": "text",
  "answer3": "text",
  "correct": 1
}
$res = innovanet('POST', '/api/education/courses/1/questions', [
    'question' => 'text',
    'image' => 'text',
    'answer1' => 'text',
    'answer2' => 'text',
    'answer3' => 'text',
    'correct' => 1,
]);

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

PUT /api/education/courses/{courseId}/questions/{questionId}

Telo

Pole Typ Povinné
question string nie
image string nie
answer1 string nie
answer2 string nie
answer3 string nie
correct integer nie
{
  "question": "text",
  "image": "text",
  "answer1": "text",
  "answer2": "text",
  "answer3": "text",
  "correct": 1
}
$res = innovanet('PUT', '/api/education/courses/1/questions/1', [
    'question' => 'text',
    'image' => 'text',
    'answer1' => 'text',
    'answer2' => 'text',
    'answer3' => 'text',
    'correct' => 1,
]);

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

DELETE /api/education/courses/{courseId}/questions/{questionId}

Bez tela.

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

GET /api/education/courses/{id}/assigned-users

Bez tela.

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

DELETE /api/education/courses/{courseId}/users/{userId}

Bez tela.

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

POST /api/education/courses/{id}/pdf

Telo

Pole Typ Povinné
file file áno

Súbor sa posiela ako multipart, nie v JSON.

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

GET /api/education/courses/{id}/pdf

Bez tela.

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

GET /api/education/certificate/{resultId}/pdf

Parametre

Pole Typ Povinné
lang string nie
language string nie

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

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

GET /api/education/results/{resultId}/detail

Bez tela.

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

GET /api/education/courses/{courseId}/certificate/{resultId}/pdf

Parametre

Pole Typ Povinné
lang string nie
language string nie

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

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


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