summaryrefslogtreecommitdiffstats
path: root/documentation/api/collections.md
blob: b79dbeda4dcb0d8b88e56fb85ac42c9321ac8d43 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212

Collections

Collections can be called with the API URL appended with the collection and resource name.

https://<domain_bas>/api/<collection>/<resource>
https://<domain_bas>/api/<collection>/:id/<resource>

Authentication

The authentication handles the authentication processes like the initial setup, login and logout methods.

https://<domain_bas>/api/authentication/

Token Login

Login method to get a JSON web token (jwt) for the Authorization header, to make authenticated API calls.

Request

POST Request - unauthorized
https://<domain_bas>/api/authentication/token

POST Body
{
    "username": "<username>",
    "password": "<password>"
}

\<username>* - Login name of the user's account.\ \<password>* - Corresponding password to the user's account.\ * Required

Response * 200 - OK

{
    "token": "<token>"
}

\<token> - Json web token (jwt)

  • 400 - Bad Request
  • INVALID_USERNAME - Username does not fullfill the requirements. (No whitespaces)
  • PASSWORD_MISSING - This services requires a password.
  • USER_MISSING - This service requires an username.
  • 401 - Unauthorized
  • PASSWORD_INVALID - The provided password is invalid.
  • 404 - Not Found
  • USER_NOTFOUND - User does not exist.
  • 500 - Internal Server Error
  • DATABASE_HASH_INVALID - The hash in the database is corrupted.
  • INVALID_UNRECOGNIZED_HASH - This hash was not made with secure-password. Attempt legacy algorithm.
  • JWT_ERROR - Jwt sign failed.
  • PASSWORD_REHASH_ERROR - Rehashing the password failed.
  • PASSWORD_VERIFY_ERROR - Verifying the password failed.

Cookie Login

Login method which sets the jwt_hp and jwt_s cookie.

Request

POST Request - unauthorized
https://<domain_bas>/api/authentication/cookies

POST Body
{
    "username": "<username>",
    "password": "<password>"
}

\<username>* - Login name of the user's account.\ \<password>* - Corresponding password to the user's account.\ * Required

Response * 200 - OK

Name Value httpOnly secure
jwt_hp false true
jwt_s true true

Logout

Deletes the cookies jwt_hp and jwt_s from the client.

Request

POST Request - unauthorized
https://<domain_bas>/api/authentication/logout

Response * 200 - OK

Setup

Status

Returns whether the unauthorized user (root account) creation can be executed.

Request

GET-Request - unauthorized
https://<domain_bas>/api/status

Response * 200 - OK * 403 - Forbidden * USERTABLE_NOT_EMPTY - The user table is not empty, unauthorized creation is forbidden.

Create Root Account

Creates the initial root account with superadmin priviliges.\ This request is only permitted when the user table is empty.

Request

POST Request - unauthorized
https://<domain_bas>/api/setup

body {
    "username": "<username>",
    "password": "<password>",
    "name": "<name>",
    "email": "<email>"
}

\<username>* - Login name of the user's account.\ \<password>* - Corresponding password to the user's account.\ \<name> - Full name of the user.\ \<email> - Email of the user.\ * Required

Response * 200 - OK * 400 - Bad Request * INVALID_USERNAME - Username does not fullfill the requirements. (No whitespaces) * PASSWORD_MISSING - This services requires a password. * PASSWORD_REQUIREMENTS - The password requirements are not fullfilled. * USER_MISSING - This service requires an username. * 401 - Unauthorized * PASSWORD_INVALID - The provided password is invalid. * 403 - Forbidden * USERTABLE_NOT_EMPTY - The user table is not empty, unauthorized creation is forbidden. * 500 - Internal Server Error * DATABASE_HASH_INVALID - The hash in the database is corrupted. * INVALID_UNRECOGNIZED_HASH - This hash was not made with secure-password. Attempt legacy algorithm. * PASSWORD_HASH_ERROR - Hashing the password failed. * PASSWORD_REHASH_ERROR - Rehashing the password failed. * PASSWORD_VERIFY_ERROR - Verifying the password failed. * USER_ALREADY_EXISTS - The provided username already exists. * USER_CREATE_ERROR - User could not be created.

Backends

Backend Types

Clients

Configloader

Configuratior

Groups

Ipxe

Log

Permissions

Registration

POST Request - unauthorized
https://<domain_bas>/api/registration

body {
    "client": {
        "name": "<name>",
        "parents": [],
        "type": "<type>",
        "uuid": "<uuid>",
        "purpose": "",
        "network": {
            "mac": "<mac>",
            "ip": "<ip>"
        },
        "location": {
            "option": "<option>",
            "insertion": "<insertion>",
            "pos": 0
        },
        "formfactor": {
            "formfactor": "<formfactor>",
            "rackunits": 1
        }
    },
    "ipxe": false
}

\<name> - Name of the client. Default: Client_uuid or Server_uuid\ parentIds - Ids of the groups the client gets added to\ \<type> - CLIENT or SERVER\ \<uuid> - UUID of the client\ \<mac> - Mac address of the client\ \<ip> - IP address of the client\ \<option> (Server only) - Horizontal or Vertical\ \<insertion> (Server only) - Front, Back, or Front and backside\ \<formfactor> (Server only) - 19\"\ \<rackunits> (Server only) - Amount of slots the server needs (int)\ \<ipxe> - Determines weather the return value is an ipxe script or not (true / false)

Roles

Users