Skip to content
This repository has been archived by the owner on Oct 17, 2024. It is now read-only.

Commit

Permalink
[EN] [V2] Update classes -> subjects and add years
Browse files Browse the repository at this point in the history
  • Loading branch information
CuzImBisonratte committed Nov 4, 2023
1 parent a6f574b commit 1c14082
Showing 1 changed file with 70 additions and 18 deletions.
88 changes: 70 additions & 18 deletions docs/endpoints/subjects.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
sidebar_position: 3
title: Classes
sidebar_position: 4
title: Subjects
tags:
- Auth
- Authentication
Expand All @@ -14,14 +14,20 @@ tags:

## Endpoints and Methods

| Endpoints | Methods | Use |
| --------------- | ------- | ------------------------- |
| /classes/ | GET | Get a List of all Classes |
| /classes/ | POST | Create a new Class |
| /classes/{:id}/ | DELETE | Delete a Class |
| /classes/{:id}/ | PATCH | Change Class details |
| Endpoints | Methods | Use |
| ------------------ | ------- | ------------------------------------------- |
| /subjects/ | GET | Get a List of all Subjects |
| /subjects/{:year}/ | GET | Get a List of all Subjects for year {:year} |
| /subjects/ | POST | Create a new Subject |
| /subjects/{:id}/ | DELETE | Delete a Subject |
| /subjects/{:id}/ | PATCH | Change Subject details |

## GET /classes/
:::note
If possible, use the `year` parameter to get a list of subjects for a specific year.
This will improve performance and reduce the amount of data that needs to be transferred.
:::

## GET /subjects/

### Request

Expand All @@ -30,7 +36,7 @@ var axios = require("axios").default;

var options = {
method: "GET",
url: "https://api.noten-app.de/v1/classes",
url: "https://api.noten-app.de/v2/subjects",
headers: { Authorization: "Bearer DFw6zar4QF33Rb6jfp7cQj2UvcrAKgun" },
};

Expand Down Expand Up @@ -58,7 +64,8 @@ axios
"grade_m": 30,
"grade_t": "10",
"grade_s": 0,
"average": 2.16667
"average": 2.16667,
"year": "sjdu6a9j"
},
{
"name": "English",
Expand All @@ -70,12 +77,56 @@ axios
"grade_m": 40,
"grade_t": "1exam",
"grade_s": 0,
"average": 2.69118
"average": 2.69118,
"year": "a76ak8g8"
}
]
```

## GET /subjects/{:id}

### Request

```js
var axios = require("axios").default;

var options = {
method: "GET",
url: "https://api.noten-app.de/v2/subjects/a76ak8g8",
headers: { Authorization: "Bearer DFw6zar4QF33Rb6jfp7cQj2UvcrAKgun" },
};

axios
.request(options)
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.error(error);
});
```

### Response

```json
[
{
"name": "English",
"color": "dddd00",
"user_id": "5negptbo-lt6v-9qos-ws1a-1s5qxe36k3op",
"id": 1,
"last_used": "2023-07-10T00:00:00.000Z",
"grade_k": 60,
"grade_m": 40,
"grade_t": "1exam",
"grade_s": 0,
"average": 2.69118,
"year": "a76ak8g8"
}
]
```

## POST /classes/
## POST /subjects/

### Request

Expand All @@ -84,7 +135,7 @@ var axios = require("axios").default;

var options = {
method: "POST",
url: "https://api.noten-app.de/v1/classes",
url: "https://api.noten-app.de/v2/subjects",
headers: {
Authorization: "Bearer DFw6zar4QF33Rb6jfp7cQj2UvcrAKgun",
"Content-Type": "application/json",
Expand All @@ -96,6 +147,7 @@ var options = {
grade_m: 45,
grade_t: "1exam",
grade_s: 10,
year: "a76ak8g8",
},
};

Expand All @@ -118,7 +170,7 @@ axios
}
```

## DELETE /classes/{:id}
## DELETE /subjects/{:id}

### Request

Expand All @@ -127,7 +179,7 @@ var axios = require("axios").default;

var options = {
method: "DELETE",
url: "https://api.noten-app.de/v1/classes/42",
url: "https://api.noten-app.de/v2/subjects/42",
headers: {
Authorization: "Bearer DFw6zar4QF33Rb6jfp7cQj2UvcrAKgun",
},
Expand All @@ -151,7 +203,7 @@ axios
}
```

## PATCH /classes/{:id}
## PATCH /subjects/{:id}

### Request

Expand All @@ -160,7 +212,7 @@ var axios = require("axios").default;

var options = {
method: "PATCH",
url: "https://api.noten-app.de/v1/classes/42",
url: "https://api.noten-app.de/v2/subjects/42",
headers: {
Authorization: "Bearer DFw6zar4QF33Rb6jfp7cQj2UvcrAKgun",
"Content-Type": "application/json",
Expand Down

0 comments on commit 1c14082

Please sign in to comment.