backend/docs/api.md
2020-09-22 18:00:28 +02:00

89 lines
3.3 KiB
Markdown
Executable File

# Dokumetacja API
| Api | Zadania endpointa |
| ------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| [/api/v1/configurator/config](#config) | Załadowanie konfiguracji startowej do aplikacji PlanNaPlan |
| [/api/v1/courses/getCoursesWithGroups](#getcourseswithgroups) | Zwrócenie wszytskich kursów razem z grupami |
| [/api/v1/groups/getCourseGroups](#getcoursegroups) | Zwrócenie grup dla danego kursu |
| [/api/v1/courses/getCourses](#getcourses) | Zwrócenie wszystkich kursów |
| [/token](#token) | Wymienia ticket z CAS-a na token ktorym beda autoryzowane chronione requesty |
## config
Source code: [link](../restservice/src/main/java/com/plannaplan/controllers/ConfigController.java)
```
POST /config
```
#### Opis
Endpoint konfigurujacy caly system i importujacy dane do bazy.
#### Parametry
| Type | Name | Consumes | Opis | Type |
| ---- | ----------------------- | ------------------- | ------------------------------- | ---- |
| Body | **file** </br> required | multipart/form-data | Plik .xlsx z potrzebnymi danymi | file |
## getCoursesWithGroups
Source code: [link](../restservice/src/main/java/com/plannaplan/controllers/getCoursesWithGroups.java)
```
GET /api/v1/courses/getCoursesWithGroups
```
#### Opis
Zwraca wszystkie dostepne kursy wraz z listą grup.
## getCourseGroups
Source code: [link](../restservice/src/main/java/com/plannaplan/controllers/GroupController.java)
```
GET /api/v1/groups/getCourseGroups
```
#### Opis
Zwraca wszytskie grupy dla danego kursu.
#### Parametry
| Type | Name | Consumes | Opis | Type |
| ----------- | --------------------- | -------- | ----------------------------------------- | ---- |
| Query Param | **id** </br> required | - | id kursu dla ktorego chcemy zwrocic grupy | int |
| Query Param | **capacity** </br> | - | czy ma zwrocic pole pojemnosci grupy | bool |
## getCourses
Source code: [link](../restservice/src/main/java/com/plannaplan/controllers/CoursesController.java)
```
GET /api/v1/courses/getCourses
```
#### Opis
Zwraca wszystkie dostepne kursy.
## token
Source code: [link](../restservice/src/main/java/com/plannaplan/controllers/TokenController.java)
```
GET /token?ticket=ST-668405-W0gfvSVDRBdMUWLweKzv-cas.amu.edu.pl
```
#### Opis
Po odpytaniu tego endpointa z podanym ticketem system zrobi nma nim validate i dostanie uzytkownika dla ktorego zostal on wygenerowany. System utworzy dla niego access token i go zwroci w odpowiedzi
#### Parametry
| Type | Name | Consumes | Opis | Type |
| ----------- | ------------------------- | -------- | --------------------------------------- | ------ |
| Query Param | **ticket** </br> required | - | ticket uzyskany z logowania poprzez CAS | string |