pyBuchaktion
pyBuchaktion REST API Documentation Version 1.0
+Data Structures ¶
Classifier Explanation
+The ‘Classifier’ describes how an attribute has to be applied. The following classifiers are available and can be combined (with some exceptions):
+-
+
-
+
+optional
The attribute does not have to exit. Cannot be combined withrequired
.
+ -
+
+required
The attribute has to exist. Cannot be combined withoptional
.
+ -
+
+secured
The attribute may only be read by administrators. Cannot be combined withsemi-secured
.
+ -
+
+semi-secured
The attribute may only be read by administrators and users that are strongly coupled to the object. Cannot be combined withsecured
.
+ -
+
+transient
The attribute is not stored and is calculated on demand by the server. Therefore it is not required to set this attribute when sending an object to the server.
+
If neither optional
nor required
are set either secured
or semi-secured
have to be set.
If either secured
or semi-secured
have been set, the following rules apply:
-
+
-
+
If the user is not permitted to see the attribute it must not be available (really not set, not even
+null
orundefined
).
+ -
+
If the user is permitted to see the attribute and neither
+optional
norrequired
are set it must be available.
+ -
+
If the user is permitted to see the attribute and either
+optional
orrequired
are set, these rules apply.
+
Account
+ +Attribute | +Type | +Classifier | +Description | +Example | +
---|---|---|---|---|
id | +number | +required | +The ID of the account. | +1987 |
+
Basic
+Date
+A date encoded in the format YYYY-MM-DD
.
ISBN-13
+An ISBN-13 without the dashes.
+TUCaN-ID
+A course ID of TUCaN (format: XX-XX-XXXX-XX
where X
is any alphanumeric character).
Book
+Attribute | +Type | +Classifier | +Description | +Example | +
---|---|---|---|---|
id | +number | +required | +The ID of the book. | +2444 |
+
isbn | +isbn | +required | +The status of the order. | +9783836218023 |
+
title | +string | +required | +The title of the book. | +Java ist auch eine Insel |
+
state | +enum[string] { AC Accepted, RJ Rejected, PP Proposed, OL Obsolete } |
++ | The state of the book. | +AC |
+
author | +string | +required | +The author of the book. | +Christian Ullenboom |
+
price | +number | ++ | The price of the book. | +49.90 |
+
Book
+Attribute | +Type | +Classifier | +Description | +Example | +
---|---|---|---|---|
id | +number | +required | +The ID of the module. | +3234 |
+
cid | +tucanid | +required | +The course ID of TUCaN. | +20-00-0004-iv |
+
name | +string | +required | +The name of the course. | +Functional and Object-oriented Programming Concepts |
+
lastOffered | +season | +required | +The season this course was last offered. | +See Season . |
+
literature | +array[book] | +required | +The recommened literature of this course. | +[ See Book . ] |
+
Book (Reduced)
+Like Book
, but literature
does not exist.
Order
+Attribute | +Type | +Classifier | +Description | +Example | +
---|---|---|---|---|
id | +number | +required | +The ID of the order. | +5862 |
+
status | +enum[string] { PD Pending, OD Ordered, RJ Rejected, AR Arrived } |
+semi-secured | +The status of the order. | +AR |
+
hint | +string | +optional | +A hint text including extended information about the status. | +Enough books available. |
+
book | +book | +required | +The ordered book. | +See Book . |
+
student | +account | +required | +The student who has ordered the book. | +See Account . |
+
timeframe | +timeframe | +required | +The timeframe in which the book order can be changed/cancelled. At the end of the timeframe the order will be processed. | +See Timeframe . |
+
Book
+Attribute | +Type | +Classifier | +Description | +Example | +
---|---|---|---|---|
id | +number | +required | +The ID of the season. | +2156 |
+
season | +enum[string] { W Winter term, S Summer term } |
+required | +The season. | +W |
+
year | +string | +required | +The year of the season. | +2017 |
+
Timeframe
+Attribute | +Type | +Classifier | +Description | +Example | +
---|---|---|---|---|
from | +date | +required | +The from-date of the timeframe (inclusive). | +2017-02-01 |
+
to | +date | +required | +The to-date of the timeframe (inclusive). | +2017-03-01 |
+
Account ¶
Account Management ¶
Notice: An account is bound to the currently logged in user. Therefore these operations may not return the same data for different users.
+Retrieve AccountGET/account
Functionality: Retrieves the current account.
+Security: Requires an authenticated user.
+Example URI
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
+ "account": {
+ "id": 987
+ }
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "account": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "number",
+ "description": "The ID of the account."
+ }
+ },
+ "required": [
+ "id"
+ ]
+ }
+ },
+ "required": [
+ "account"
+ ]
+}
401
Send if: The user is not authenticated.
+403
Send if: The user does not have the required permissions.
+Modify AccountPATCH/account
Functionality: Changes the given properties of the current account.
+Security: Requires an authenticated user.
+Example URI
Headers
Content-Type: application/json
Body
{
+ "account": "Hello, world!"
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "account": {
+ "type": "string",
+ "description": "<!-- TODO: To be updated. -->"
+ }
+ },
+ "required": [
+ "account"
+ ]
+}
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
+ "account": {
+ "id": 987
+ }
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "account": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "number",
+ "description": "The ID of the account."
+ }
+ },
+ "required": [
+ "id"
+ ]
+ }
+ },
+ "required": [
+ "account"
+ ]
+}
401
Send if: The user is not authenticated.
+403
Send if: The user does not have the required permissions.
+422
Send if: The given item cannot be processed (e.g. if it is invalid).
+Delete Account DataDELETE/account
Functionality: Deletes the data of the current account.
+Security: Requires an authenticated user.
+Example URI
204
Headers
Content-Type: application/json; charset=utf-8
401
Send if: The user is not authenticated.
+403
Send if: The user does not have the required permissions.
+422
Send if: The given item cannot be processed (e.g. if it is invalid).
+Retrieve OrdersGET/account/orders{?page,limit,status,orderBy}
Functionality: Retrieves the orders of the current account matching the given criteria.
+Security: Requires an authenticated user.
+Example URI
- page
number
(optional) Example: 1pagination - The page to return. Defaults to
+1
.- limit
number
(optional) Example: 10pagination - The number of items per page. Defaults to
+10
.- status
string
(optional) Example: ODA comma-separated list of states to filter for.
+-
+
-
+
+PD
Pending
+ -
+
+OD
Ordered
+ -
+
+RJ
Rejected
+ -
+
+AR
Arrived
+
-
+
- orderBy
string
(optional) Example: statusThe field to order by. Defaults to no specific order.
+-
+
-
+
+status
Order by the status.
+ -
+
+timeframe
Order by the timeframe.
+
-
+
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
+ "orders": [
+ {
+ "id": 5862,
+ "status": "AR",
+ "hint": "Enough books available.",
+ "book": {
+ "id": 2444,
+ "isbn": "9783836218023",
+ "title": "Java ist auch eine Insel",
+ "state": "AC",
+ "author": "Christian Ullenboom",
+ "price": 49.9
+ },
+ "student": {
+ "id": 987
+ },
+ "timeframe": {
+ "from": "2017-02-01",
+ "to": "2017-03-01"
+ }
+ }
+ ],
+ "total": 10
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "orders": {
+ "type": "array"
+ },
+ "total": {
+ "type": "number"
+ }
+ },
+ "required": [
+ "orders",
+ "total"
+ ]
+}
400
Send if: Wrong parameters where sent from the user.
+401
Send if: The user is not authenticated.
+403
Send if: The user does not have the required permissions.
+Books ¶
Multiple Books ¶
Retrieve BooksGET/books{?page,limit,isbn,title,state,author,orderBy}
Functionality: Retrieves all books matching the given criteria.
+Example URI
- page
number
(optional) Example: 1pagination - The page to return. Defaults to
+1
.- limit
number
(optional) Example: 10pagination - The number of items per page. Defaults to
+10
.- isbn
isbn
(optional) Example: 9783836218023A comma-separated list of ISBNs to filter for.
+- title
string
(optional) Example: javaThe title to filter for. Represents a case-insensitive text search.
+- state
string
(optional) Example: ACA comma-separated list of states to filter for.
+Choices:
AC
RJ
PP
OL
- author
string
(optional) Example: ullenboomThe author to filter for. Represents a case-insensitive text search.
+- orderBy
string
(optional) Example: authorThe field to order by. Defaults to no specific order.
+-
+
-
+
+isbn
Order by the ISBN.
+ -
+
+title
Order by the title.
+ -
+
+state
Order by the state.
+ -
+
+author
Order by the author.
+
-
+
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
+ "books": [
+ {
+ "id": 2444,
+ "isbn": "9783836218023",
+ "title": "Java ist auch eine Insel",
+ "state": "AC",
+ "author": "Christian Ullenboom",
+ "price": 49.9
+ }
+ ],
+ "total": 10
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "books": {
+ "type": "array"
+ },
+ "total": {
+ "type": "number"
+ }
+ },
+ "required": [
+ "books",
+ "total"
+ ]
+}
400
Send if: Wrong parameters where sent from the user.
+Propose BookPUT/books
Functionality: Proposes a new book that has to be approved by an administrator. If this endpoint.
+Security: Requires an authenticated user.
+Example URI
Create by ISBN
Headers
Content-Type: application/json
Body
{
+ "book": {
+ "isbn": "9783836218023"
+ }
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "book": {
+ "type": "object",
+ "properties": {
+ "isbn": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "required": [
+ "book"
+ ]
+}
Create by Author/Title
Headers
Content-Type: application/json
Body
{
+ "book": {
+ "title": "Java ist auch eine Insel",
+ "author": "Christian Ullenboom"
+ }
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "book": {
+ "type": "object",
+ "properties": {
+ "title": {
+ "type": "string"
+ },
+ "author": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "required": [
+ "book"
+ ]
+}
201
Send if: The book was created an accepted (this is only possible if the proposal was sent by an administrator).
+Headers
Content-Type: application/json; charset=utf-8
Body
{
+ "book": {
+ "id": 2444,
+ "isbn": "9783836218023",
+ "title": "Java ist auch eine Insel",
+ "state": "AC",
+ "author": "Christian Ullenboom",
+ "price": 49.9
+ }
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "book": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "number",
+ "description": "The ID of the book."
+ },
+ "isbn": {
+ "type": "string",
+ "description": "The ISBN of the book."
+ },
+ "title": {
+ "type": "string",
+ "description": "The title of the book."
+ },
+ "state": {
+ "type": "string",
+ "enum": [
+ "AC",
+ "RJ",
+ "PP",
+ "OL"
+ ],
+ "description": "secured - The state of the book."
+ },
+ "author": {
+ "type": "string",
+ "description": "The author of the book."
+ },
+ "price": {
+ "type": "number",
+ "description": "secured - The price of the book."
+ }
+ },
+ "required": [
+ "id",
+ "isbn",
+ "title",
+ "author"
+ ]
+ }
+ },
+ "required": [
+ "book"
+ ]
+}
202
Send if: The book was created and is waiting for approval.
+Headers
Content-Type: application/json; charset=utf-8
Body
{
+ "book": {
+ "id": 2444,
+ "isbn": "9783836218023",
+ "title": "Java ist auch eine Insel",
+ "state": "AC",
+ "author": "Christian Ullenboom",
+ "price": 49.9
+ }
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "book": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "number",
+ "description": "The ID of the book."
+ },
+ "isbn": {
+ "type": "string",
+ "description": "The ISBN of the book."
+ },
+ "title": {
+ "type": "string",
+ "description": "The title of the book."
+ },
+ "state": {
+ "type": "string",
+ "enum": [
+ "AC",
+ "RJ",
+ "PP",
+ "OL"
+ ],
+ "description": "secured - The state of the book."
+ },
+ "author": {
+ "type": "string",
+ "description": "The author of the book."
+ },
+ "price": {
+ "type": "number",
+ "description": "secured - The price of the book."
+ }
+ },
+ "required": [
+ "id",
+ "isbn",
+ "title",
+ "author"
+ ]
+ }
+ },
+ "required": [
+ "book"
+ ]
+}
401
Send if: The user is not authenticated.
+403
Send if: The user does not have the required permissions.
+404
Send if: The specified book was not found.
+409
Send if: The book already exists.
+422
Send if: The given item cannot be processed (e.g. if it is invalid).
+Specific Book ¶
Retrieve BookGET/books/{bookId}
Functionality: Retrieves the specified book.
+Example URI
- bookId
number
(required) Example: 2444The ID of the book.
+
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
+ "book": {
+ "id": 2444,
+ "isbn": "9783836218023",
+ "title": "Java ist auch eine Insel",
+ "state": "AC",
+ "author": "Christian Ullenboom",
+ "price": 49.9
+ }
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "book": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "number",
+ "description": "The ID of the book."
+ },
+ "isbn": {
+ "type": "string",
+ "description": "The ISBN of the book."
+ },
+ "title": {
+ "type": "string",
+ "description": "The title of the book."
+ },
+ "state": {
+ "type": "string",
+ "enum": [
+ "AC",
+ "RJ",
+ "PP",
+ "OL"
+ ],
+ "description": "secured - The state of the book."
+ },
+ "author": {
+ "type": "string",
+ "description": "The author of the book."
+ },
+ "price": {
+ "type": "number",
+ "description": "secured - The price of the book."
+ }
+ },
+ "required": [
+ "id",
+ "isbn",
+ "title",
+ "author"
+ ]
+ }
+ },
+ "required": [
+ "book"
+ ]
+}
404
Send if: The specified book was not found
+Modify BookPATCH/books/{bookId}
Functionality: Changes the given properties of the specified book.
+Security: Requires an authenticated user with the role admin
.
Example URI
- bookId
number
(required) Example: 2444The ID of the book.
+
Headers
Content-Type: application/json
Body
{
+ "isbn": "9783836218023",
+ "title": "Java ist auch eine Insel",
+ "state": "AC",
+ "author": "Christian Ullenboom",
+ "price": 49.9
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "isbn": {
+ "type": "string"
+ },
+ "title": {
+ "type": "string"
+ },
+ "state": {
+ "type": "string",
+ "enum": [
+ "AC",
+ "RJ",
+ "PP",
+ "OL"
+ ]
+ },
+ "author": {
+ "type": "string"
+ },
+ "price": {
+ "type": "number"
+ }
+ }
+}
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
+ "book": {
+ "id": 2444,
+ "isbn": "9783836218023",
+ "title": "Java ist auch eine Insel",
+ "state": "AC",
+ "author": "Christian Ullenboom",
+ "price": 49.9
+ }
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "book": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "number",
+ "description": "The ID of the book."
+ },
+ "isbn": {
+ "type": "string",
+ "description": "The ISBN of the book."
+ },
+ "title": {
+ "type": "string",
+ "description": "The title of the book."
+ },
+ "state": {
+ "type": "string",
+ "enum": [
+ "AC",
+ "RJ",
+ "PP",
+ "OL"
+ ],
+ "description": "secured - The state of the book."
+ },
+ "author": {
+ "type": "string",
+ "description": "The author of the book."
+ },
+ "price": {
+ "type": "number",
+ "description": "secured - The price of the book."
+ }
+ },
+ "required": [
+ "id",
+ "isbn",
+ "title",
+ "author"
+ ]
+ }
+ },
+ "required": [
+ "book"
+ ]
+}
401
Send if: The user is not authenticated.
+403
Send if: The user does not have the required permissions.
+404
Send if: The specified book was not found
+422
Send if: The given item cannot be processed (e.g. if it is invalid).
+Delete BookDELETE/books/{bookId}
Functionality: Deletes the specified book.
+Security: Requires an authenticated user with the role admin
.
Example URI
- bookId
number
(required) Example: 2444The ID of the book.
+
204
Headers
Content-Type: application/json; charset=utf-8
401
Send if: The user is not authenticated.
+403
Send if: The user does not have the required permissions.
+404
Send if: The specified book was not found
+422
Send if: The given item cannot be processed (e.g. if it is invalid).
+Modules ¶
Multiple Modules ¶
Retrieve ModulesGET/modules{?page,limit,cid,name}
Functionality: Retrieves all modules matching the given criteria.
+Example URI
- page
number
(optional) Example: 1pagination - The page to return. Defaults to
+1
.- limit
number
(optional) Example: 10pagination - The number of items per page. Defaults to
+10
.- cid
tucanid
(optional) Example: 20-00-0004-ivA comma-separated list of TUCaN course IDs to filter for.
+- name
string
(optional) Example: programmingThe course name to filter for. Represents a case-insensitive text search.
+
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
+ "modules": [
+ {
+ "id": 3234,
+ "cid": "20-00-0004-iv",
+ "name": "Functional and Object-oriented Programming Concepts",
+ "lastOffered": {
+ "id": 2156,
+ "season": "W",
+ "year": "2017"
+ }
+ }
+ ],
+ "total": 0
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "modules": {
+ "type": "array"
+ },
+ "total": {
+ "type": "number"
+ }
+ },
+ "required": [
+ "modules",
+ "total"
+ ]
+}
400
Send if: Wrong parameters where sent from the user.
+Create ModulePUT/modules
Functionality: Creates a new module.
+Security: Requires an authenticated user with the role admin
.
Example URI
Headers
Content-Type: application/json
Body
{
+ "module": {
+ "cid": "20-00-0004-iv",
+ "name": "Functional and Object-oriented Programming Concepts",
+ "lastOffered": {
+ "id": 2156,
+ "season": "W",
+ "year": "2017"
+ },
+ "literature": []
+ }
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "module": {
+ "type": "object",
+ "properties": {
+ "cid": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "lastOffered": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "number",
+ "description": "The ID of the season."
+ },
+ "season": {
+ "type": "string",
+ "enum": [
+ "W",
+ "S"
+ ],
+ "description": "The season."
+ },
+ "year": {
+ "type": "string",
+ "description": "The year of the season."
+ }
+ },
+ "required": [
+ "id",
+ "season",
+ "year"
+ ]
+ },
+ "literature": {
+ "type": "array",
+ "description": "The IDs of the proposed books."
+ }
+ },
+ "required": [
+ "cid",
+ "name",
+ "lastOffered"
+ ]
+ }
+ },
+ "required": [
+ "module"
+ ]
+}
201
Headers
Content-Type: application/json; charset=utf-8
Body
{
+ "module": {
+ "id": 3234,
+ "cid": "20-00-0004-iv",
+ "name": "Functional and Object-oriented Programming Concepts",
+ "lastOffered": {
+ "id": 2156,
+ "season": "W",
+ "year": "2017"
+ },
+ "literature": [
+ {
+ "id": 2444,
+ "isbn": "9783836218023",
+ "title": "Java ist auch eine Insel",
+ "state": "AC",
+ "author": "Christian Ullenboom",
+ "price": 49.9
+ }
+ ]
+ }
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "module": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "number",
+ "description": "The ID of the module."
+ },
+ "cid": {
+ "type": "string",
+ "description": "The course ID of TUCaN."
+ },
+ "name": {
+ "type": "string",
+ "description": "The name of the course."
+ },
+ "lastOffered": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "number",
+ "description": "The ID of the season."
+ },
+ "season": {
+ "type": "string",
+ "enum": [
+ "W",
+ "S"
+ ],
+ "description": "The season."
+ },
+ "year": {
+ "type": "string",
+ "description": "The year of the season."
+ }
+ },
+ "required": [
+ "id",
+ "season",
+ "year"
+ ],
+ "description": "The season this course was last offered."
+ },
+ "literature": {
+ "type": "array",
+ "description": "The recommened literature of this course."
+ }
+ },
+ "required": [
+ "id",
+ "cid",
+ "name",
+ "lastOffered",
+ "literature"
+ ]
+ }
+ },
+ "required": [
+ "module"
+ ]
+}
401
Send if: The user is not authenticated.
+403
Send if: The user does not have the required permissions.
+422
Send if: The given item cannot be processed (e.g. if it is invalid).
+Specific Moudle ¶
Retrieve ModuleGET/modules/{moduleId}
Functionality: Retrieves the specified module.
+Example URI
- moduleId
number
(required) Example: 3234The ID of the module.
+
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
+ "module": {
+ "id": 3234,
+ "cid": "20-00-0004-iv",
+ "name": "Functional and Object-oriented Programming Concepts",
+ "lastOffered": {
+ "id": 2156,
+ "season": "W",
+ "year": "2017"
+ },
+ "literature": [
+ {
+ "id": 2444,
+ "isbn": "9783836218023",
+ "title": "Java ist auch eine Insel",
+ "state": "AC",
+ "author": "Christian Ullenboom",
+ "price": 49.9
+ }
+ ]
+ }
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "module": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "number",
+ "description": "The ID of the module."
+ },
+ "cid": {
+ "type": "string",
+ "description": "The course ID of TUCaN."
+ },
+ "name": {
+ "type": "string",
+ "description": "The name of the course."
+ },
+ "lastOffered": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "number",
+ "description": "The ID of the season."
+ },
+ "season": {
+ "type": "string",
+ "enum": [
+ "W",
+ "S"
+ ],
+ "description": "The season."
+ },
+ "year": {
+ "type": "string",
+ "description": "The year of the season."
+ }
+ },
+ "required": [
+ "id",
+ "season",
+ "year"
+ ],
+ "description": "The season this course was last offered."
+ },
+ "literature": {
+ "type": "array",
+ "description": "The recommened literature of this course."
+ }
+ },
+ "required": [
+ "id",
+ "cid",
+ "name",
+ "lastOffered",
+ "literature"
+ ]
+ }
+ },
+ "required": [
+ "module"
+ ]
+}
404
Send if: The specified module was not found.
+Modify ModulePATCH/modules/{moduleId}
Functionality: Changes the given properties of the specified module.
+Security: Requires an authenticated user with the role admin
.
Example URI
- moduleId
number
(required) Example: 3234The ID of the module.
+
Headers
Content-Type: application/json
Body
{
+ "module": {
+ "cid": "20-00-0004-iv",
+ "name": "Functional and Object-oriented Programming Concepts",
+ "lastOffered": {
+ "id": 2156,
+ "season": "W",
+ "year": "2017"
+ },
+ "literature": []
+ }
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "module": {
+ "type": "object",
+ "properties": {
+ "cid": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "lastOffered": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "number",
+ "description": "The ID of the season."
+ },
+ "season": {
+ "type": "string",
+ "enum": [
+ "W",
+ "S"
+ ],
+ "description": "The season."
+ },
+ "year": {
+ "type": "string",
+ "description": "The year of the season."
+ }
+ },
+ "required": [
+ "id",
+ "season",
+ "year"
+ ]
+ },
+ "literature": {
+ "type": "array",
+ "description": "The IDs of the proposed books."
+ }
+ }
+ }
+ },
+ "required": [
+ "module"
+ ]
+}
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
+ "module": {
+ "id": 3234,
+ "cid": "20-00-0004-iv",
+ "name": "Functional and Object-oriented Programming Concepts",
+ "lastOffered": {
+ "id": 2156,
+ "season": "W",
+ "year": "2017"
+ },
+ "literature": [
+ {
+ "id": 2444,
+ "isbn": "9783836218023",
+ "title": "Java ist auch eine Insel",
+ "state": "AC",
+ "author": "Christian Ullenboom",
+ "price": 49.9
+ }
+ ]
+ }
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "module": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "number",
+ "description": "The ID of the module."
+ },
+ "cid": {
+ "type": "string",
+ "description": "The course ID of TUCaN."
+ },
+ "name": {
+ "type": "string",
+ "description": "The name of the course."
+ },
+ "lastOffered": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "number",
+ "description": "The ID of the season."
+ },
+ "season": {
+ "type": "string",
+ "enum": [
+ "W",
+ "S"
+ ],
+ "description": "The season."
+ },
+ "year": {
+ "type": "string",
+ "description": "The year of the season."
+ }
+ },
+ "required": [
+ "id",
+ "season",
+ "year"
+ ],
+ "description": "The season this course was last offered."
+ },
+ "literature": {
+ "type": "array",
+ "description": "The recommened literature of this course."
+ }
+ },
+ "required": [
+ "id",
+ "cid",
+ "name",
+ "lastOffered",
+ "literature"
+ ]
+ }
+ },
+ "required": [
+ "module"
+ ]
+}
401
Send if: The user is not authenticated.
+403
Send if: The user does not have the required permissions.
+404
Send if: The specified module was not found.
+422
Send if: The given item cannot be processed (e.g. if it is invalid).
+Delete ModuleDELETE/modules/{moduleId}
Functionality: Deletes the specified module.
+Security: Requires an authenticated user with the role admin
.
Example URI
- moduleId
number
(required) Example: 3234The ID of the module.
+
204
Headers
Content-Type: application/json; charset=utf-8
401
Send if: The user is not authenticated.
+403
Send if: The user does not have the required permissions.
+404
Send if: The specified module was not found.
+422
Send if: The given item cannot be processed (e.g. if it is invalid).
+Orders ¶
Multiple Orders ¶
Retrieve OrdersGET/orders{?page,limit,userId,status,orderBy}
Functionality: Retrieves all orders that are visible to the current user (that is, only the orders of the logged in user or all orders if the logged in user as the role admin
).
Security: Requires an authenticated user.
+Example URI
- page
number
(optional) Example: 1pagination - The page to return. Defaults to
+1
.- limit
number
(optional) Example: 10pagination - The number of items per page. Defaults to
+10
.- userId
number
(optional) Example: 1987A comma-separated list of user IDs to filter for. This property does not have any functionality if the current user does not have the role
+admin
.- status
string
(optional) Example: ODA comma-separated list of states to filter for.
+Choices:
PD
OD
RJ
AR
- orderBy
string
(optional) Example: statusThe field to order by. Defaults to no specific order.
+-
+
-
+
+status
Order by the status.
+ -
+
+timeframe
Order by the timeframe.
+
-
+
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
+ "orders": [
+ {
+ "id": 5862,
+ "status": "AR",
+ "hint": "Enough books available.",
+ "book": {
+ "id": 2444,
+ "isbn": "9783836218023",
+ "title": "Java ist auch eine Insel",
+ "state": "AC",
+ "author": "Christian Ullenboom",
+ "price": 49.9
+ },
+ "student": {
+ "id": 987
+ },
+ "timeframe": {
+ "from": "2017-02-01",
+ "to": "2017-03-01"
+ }
+ }
+ ],
+ "total": 10
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "orders": {
+ "type": "array"
+ },
+ "total": {
+ "type": "number"
+ }
+ },
+ "required": [
+ "orders",
+ "total"
+ ]
+}
400
Send if: Wrong parameters where sent from the user.
+401
Send if: The user is not authenticated.
+403
Send if: The user does not have the required permissions.
+Specific Order ¶
Modify OrderPATCH/orders/{orderId}
Functionality: Changes the given properties of the specified order.
+Security: Requires an authenticated user with the role admin
.
Example URI
- orderId
number
(required) Example: 5862The ID of the order.
+
Headers
Content-Type: application/json
Body
{
+ "order": {
+ "status": "PD",
+ "hint": "Enough books available."
+ }
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "order": {
+ "type": "object",
+ "properties": {
+ "status": {
+ "type": "string",
+ "enum": [
+ "PD",
+ "OD",
+ "RJ",
+ "AR"
+ ]
+ },
+ "hint": {
+ "type": "string"
+ }
+ }
+ }
+ },
+ "required": [
+ "order"
+ ]
+}
200
Headers
Content-Type: application/json; charset=utf-8
Body
{
+ "order": {
+ "id": 5862,
+ "status": "AR",
+ "hint": "Enough books available.",
+ "book": {
+ "id": 2444,
+ "isbn": "9783836218023",
+ "title": "Java ist auch eine Insel",
+ "state": "AC",
+ "author": "Christian Ullenboom",
+ "price": 49.9
+ },
+ "student": {
+ "id": 987
+ },
+ "timeframe": {
+ "from": "2017-02-01",
+ "to": "2017-03-01"
+ }
+ }
+}
Schema
{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "type": "object",
+ "properties": {
+ "order": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "number",
+ "description": "The ID of the order."
+ },
+ "status": {
+ "type": "string",
+ "enum": [
+ "PD",
+ "OD",
+ "RJ",
+ "AR"
+ ],
+ "description": "semi-secured - The status of the order."
+ },
+ "hint": {
+ "type": "string",
+ "description": "A hint text including extended information about the status."
+ },
+ "book": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "number",
+ "description": "The ID of the book."
+ },
+ "isbn": {
+ "type": "string",
+ "description": "The ISBN of the book."
+ },
+ "title": {
+ "type": "string",
+ "description": "The title of the book."
+ },
+ "state": {
+ "type": "string",
+ "enum": [
+ "AC",
+ "RJ",
+ "PP",
+ "OL"
+ ],
+ "description": "secured - The state of the book."
+ },
+ "author": {
+ "type": "string",
+ "description": "The author of the book."
+ },
+ "price": {
+ "type": "number",
+ "description": "secured - The price of the book."
+ }
+ },
+ "required": [
+ "id",
+ "isbn",
+ "title",
+ "author"
+ ],
+ "description": "The ordered book."
+ },
+ "student": {
+ "type": "object",
+ "properties": {
+ "id": {
+ "type": "number",
+ "description": "The ID of the account."
+ }
+ },
+ "required": [
+ "id"
+ ],
+ "description": "The student who has ordered the book."
+ },
+ "timeframe": {
+ "type": "object",
+ "properties": {
+ "from": {
+ "type": "string",
+ "description": "The from-date of the timeframe (inclusive)."
+ },
+ "to": {
+ "type": "string",
+ "description": "The to-date of the timeframe (inclusive)."
+ }
+ },
+ "required": [
+ "from",
+ "to"
+ ],
+ "description": "The timeframe in which the book order can be changed/cancelled. At the end of the timeframe the order will be processed."
+ }
+ },
+ "required": [
+ "id",
+ "book",
+ "student",
+ "timeframe"
+ ]
+ }
+ },
+ "required": [
+ "order"
+ ]
+}
401
Send if: The user is not authenticated.
+403
Send if: The user does not have the required permissions.
+404
Send if: The specified order was not found.
+422
Send if: The given item cannot be processed (e.g. if it is invalid).
+Delete OrderDELETE/orders/{orderId}
Functionality: Deletes the specified order.
+Security: Requires an authenticated user with the role admin
or the user who has created the order.
Example URI
- orderId
number
(required) Example: 5862The ID of the order.
+
204
Headers
Content-Type: application/json; charset=utf-8
401
Send if: The user is not authenticated.
+403
Send if: The user does not have the required permissions.
+404
Send if: The specified order was not found.
+