239 lines
6.3 KiB
Markdown
239 lines
6.3 KiB
Markdown
# Specifikation för att hämta kurser och scheman i Daisys nya API
|
|
|
|
## Hämta lista på kurser
|
|
|
|
### Förfrågan
|
|
|
|
```
|
|
> GET /v1/users/me/courses
|
|
> Authorization: Bearer <oauth 2 token>
|
|
> Accept: application/json
|
|
```
|
|
|
|
Ger mig (identifierad av oauth 2 token) alla mina kurser med delkurstillfällen jag är registrerad/deltagare på.
|
|
|
|
### Svar
|
|
|
|
```
|
|
< 200 OK
|
|
< Content-Type: application/json
|
|
```
|
|
|
|
```json
|
|
[
|
|
{
|
|
"code": "PROLED",
|
|
"occasions": [
|
|
{
|
|
"id": "123456",
|
|
"semester": "VT2025",
|
|
"start": "2025-01-03",
|
|
"end": "2025-06-03",
|
|
"teachers": [{ "principal": "teacher1@su" }, { "principal": "teacher2@su" }]
|
|
},
|
|
{
|
|
"id": "1234567",
|
|
"semester": "HT2025",
|
|
"start": "2025-09-03",
|
|
"end": "2026-01-03",
|
|
"teachers": [{ "principal": "teacher1@su" }, { "principal": "teacher2@su" }]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"code": "PROTO2",
|
|
"occasions": [
|
|
{
|
|
"id": "123456",
|
|
"semester": "HT2025",
|
|
"start": "2025-09-03",
|
|
"end": "2026-01-03",
|
|
"teachers": [{ "principal": "teacher3@su" }, { "principal": "teacher4@su" }]
|
|
}
|
|
]
|
|
}
|
|
]
|
|
```
|
|
|
|
## Hämta kursschema
|
|
|
|
### Förfrågan
|
|
|
|
```
|
|
> GET /v1/courses/:courseId/schedule
|
|
> Authorization: Bearer <oauth 2 token>
|
|
> Accept: application/json
|
|
```
|
|
|
|
**`type` (string, enum):**
|
|
|
|
| Value | Description |
|
|
| -------- | ------------ |
|
|
| teaching | Undervisning |
|
|
| exam | Tenta |
|
|
| deadline | Deadline |
|
|
|
|
```json
|
|
[
|
|
{
|
|
"type": "teaching",
|
|
"name": "Föreläsning 1",
|
|
"shortname": "F1",
|
|
"starttime": "2025-01-03T10:00:00Z",
|
|
"endtime": "2025-01-03T12:00:00Z",
|
|
"location": [{ "name": "L30" }],
|
|
"description": "Lecture on API Design",
|
|
"participants": [
|
|
{ "principal": "teacher1@su", "role": "teacher" },
|
|
{ "principal": "teacher2@su", "role": "teacher" }
|
|
]
|
|
},
|
|
{
|
|
"type": "teaching",
|
|
"name": "Workshop 1",
|
|
"shortname": "W1",
|
|
"group": "1",
|
|
"starttime": "2025-01-03T10:00:00Z",
|
|
"endtime": "2025-01-03T12:00:00Z",
|
|
"location": [{ "name": "L50" }],
|
|
"description": "Workshop on Microservices",
|
|
"participants": [
|
|
{ "principal": "teacher1@su", "role": "teacher" },
|
|
{ "principal": "teacher2@su", "role": "teacher" }
|
|
]
|
|
}
|
|
]
|
|
```
|
|
|
|
## Hämta personligt schema
|
|
|
|
### Förfrågan
|
|
|
|
```
|
|
> GET /v1/users/me/schedule?maxResults=10&startTime=ISO-timestamp&endTime=ISO-timestamp
|
|
> Authorization: Bearer <oauth 2 token>
|
|
> Accept: application/json
|
|
```
|
|
|
|
### Stanardschema för event:
|
|
|
|
```json
|
|
{
|
|
"locations": [{ "room": "string" }],
|
|
"name": "string",
|
|
"eventType": "enum string",
|
|
"startTime": "ISO-timestamp",
|
|
"endTime": "ISO-timestamp",
|
|
"details": {
|
|
// beroende på eventType
|
|
// courseEventType
|
|
// bookingEventType
|
|
// etc
|
|
}
|
|
}
|
|
```
|
|
|
|
**`EventType` (string, enum):**
|
|
|
|
| Value | Description |
|
|
| ------------ | ---------------- |
|
|
| teaching | Undervisning |
|
|
| room booking | Bokningar av rum |
|
|
| deadline | Deadline |
|
|
| workshop | Workshop |
|
|
|
|
NOTE: Varför inkluderade vi workshop?
|
|
|
|
Details-objekt beroende på eventType:
|
|
|
|
```json
|
|
{
|
|
"courseEventType": {
|
|
"courseCode": "string",
|
|
"occasionId": "string",
|
|
"semester": "string",
|
|
"type": "enum string", // teaching, exam, deadline etc
|
|
"shortname": "string",
|
|
"description": "string",
|
|
"participants": [{ "principal": "string" }]
|
|
},
|
|
"bookingEventType": {
|
|
"identifier": "string",
|
|
"description": "string",
|
|
"organizer": { "name": "string", "principal": "string" },
|
|
"type": "enum string", // in-person, online, hybrid
|
|
"participants": [{ "principal": "string" }]
|
|
},
|
|
"deadlineEventType": {
|
|
"description": "string",
|
|
"relatedTo": { "type": "enum string", "identifier": "string" } // course, booking, other
|
|
},
|
|
"workshopEventType": {
|
|
"description": "string",
|
|
"type": "enum string", // in-person, online, hybrid
|
|
"participants": [{ "principal": "string" }]
|
|
}
|
|
}
|
|
```
|
|
|
|
### Exempel
|
|
|
|
```json
|
|
[
|
|
{
|
|
"locations": [{ "room": "L30" }],
|
|
"name": "Föreläsning 1",
|
|
"eventType": "teaching",
|
|
"startTime": "2025-01-03T10:00:00Z",
|
|
"endTime": "2025-01-03T12:00:00Z",
|
|
"details": {
|
|
"courseCode": "PROLED",
|
|
"occasionId": 123456,
|
|
"semester": "VT2025",
|
|
"type": "Undervisning",
|
|
"shortname": "F1",
|
|
"description": "Lecture on API Design",
|
|
"participants": [{ "principal": "teacher1@su" }, { "principal": "teacher2@su" }]
|
|
}
|
|
},
|
|
{
|
|
"locations": [{ "room": "G10:3" }],
|
|
"name": "Gruppmöte",
|
|
"eventType": "room booking",
|
|
"startTime": "2025-01-03T09:00:00Z",
|
|
"endTime": "2025-01-03T10:00:00Z",
|
|
"details": {
|
|
"identifier": "booking-12345",
|
|
"description": "Group Meeting",
|
|
"organizer": { "name": "Student 1", "principal": "student1@su" },
|
|
"description": "Discuss project progress",
|
|
"participants": [{ "principal": "student1@su" }, { "principal": "student2@su" }]
|
|
}
|
|
},
|
|
{
|
|
"locations": [{ "room": "L50" }],
|
|
"name": "Workshop 1",
|
|
"eventType": "workshop",
|
|
"startTime": "2025-01-03T09:00:00Z",
|
|
"endTime": "2025-01-03T10:00:00Z",
|
|
"details": {
|
|
"description": "Prepare a presentation",
|
|
"type": "In-Person",
|
|
"participants": [{ "principal": "teacher1@su" }, { "principal": "teacher2@su" }]
|
|
}
|
|
},
|
|
{
|
|
"locations": [{ "room": "G10:4" }],
|
|
"name": "Tentaplugg",
|
|
"eventType": "room booking",
|
|
"startTime": "2025-01-03T09:00:00Z",
|
|
"endTime": "2025-01-03T10:00:00Z",
|
|
"details": {
|
|
"description": "Tentaplugg - Don't forget the snacks",
|
|
"type": "In-Person",
|
|
"participants": [{ "principal": "student1@su" }, { "principal": "student2@su" }]
|
|
}
|
|
}
|
|
]
|
|
```
|