Přeskočit obsah

API – E-learning

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

Správce kurzů volá /api/education/courses. Zaměstnanec své kurzy na /api/education/my-courses.

GET /api/education/courses

Parametr Typ Povinné Popis
search string ne
categoryId integer ne
includeHidden boolean ne skryté kurzy, jen správce
$res = innovanet('GET', '/api/education/courses?search=BOZP');

Odpověď 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. Kategorie: GET /api/education/categories.

POST /api/education/courses

Pole Typ Povinné Popis
title string ano nejvýše 500
description string ne
intro string ne
categoryId integer ne
minResult integer ne procenta 0–100, výchozí 80
timeLimitMinutes integer ne
daysToComplete integer ne
onlyOnce integer ne 0 nebo 1
hide integer ne 1 skryje kurz před běžným seznamem

PHP

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

Odpověď 201

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

Přiřazení lidí: POST /api/education/courses/2/assign-users. Odevzdání testu: POST /api/education/courses/2/submit.

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

answers je objekt, klíč je id otázky, hodnota 1, 2 nebo 3. Odpověď 200 má v data.passed, zda test prošel.

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.

PUT /api/education/categories/{id}

Tělo

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

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

DELETE /api/education/categories/{id}

Bez těla.

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

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

Bez těla.

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

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

Bez těla.

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

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

Bez těla.

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

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

Bez těla.

Otázky kurzu vidí správce e-learningu, autor kurzu a přidělení uživatelé (jinak 403). Pole correct (správná odpověď 1 až 3) dostane jen správce a autor. Kdo test řeší, klíč nedostane: test se vyhodnocuje na serveru (POST /api/education/courses/{id}/submit) a správné odpovědi se zobrazí až ve výsledku.

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

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

Tělo

Pole Typ Povinné
question string ano
image string ne
answer1 string ano
answer2 string ano
answer3 string ano
correct integer ano
{
  "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,
]);

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

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

Tělo

Pole Typ Povinné
question string ne
image string ne
answer1 string ne
answer2 string ne
answer3 string ne
correct integer ne
{
  "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,
]);

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

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

Bez těla.

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

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

Bez těla.

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

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

Bez těla.

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

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

Tělo

Pole Typ Povinné
file file ano

Soubor se posílá jako multipart, ne v JSON.

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

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

Bez těla.

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

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

Parametry

Pole Typ Povinné
lang string ne
language string ne

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

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

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

Bez těla.

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

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

Parametry

Pole Typ Povinné
lang string ne
language string ne

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

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


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