summaryrefslogblamecommitdiffstats
path: root/documentation/api/collections.md
blob: e36fc0ec82f3e572a1f12741d7e5036abb34a670 (plain) (tree)
1
2
3
4
             
                                                                                          
   
                                                











                                                                                                         
                                                                                                         




















































































                                                                                                        
                                                                              





























































                                                                                                        
      
              








                                     
                                 

                         






                                         
                     
                        
                                       






















                                                     


                                         
                                    





                 
















                                                                                               

                                          



                                                                                            

        

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": [<parentIds>],
        "type": "<type>",
        "uuid": "<uuid>",
        "purpose": "<purpose>",
        "contacts": [
            {
                "last_name": <lastName>,
                "first_name": <firstName>
            }
        ],
        "location": {
            "bay": <bay>
            "insertion": "<insertion>",
            "option": "<option>",
            "slot": <slot>
        },
        "networks": [
            {
                "ip": "<ip>",
                "mac": "<mac>",
                "primary": <primary>,
                "hostname": "<hostname>",
                "device": {
                    "speed": "<speeed>",
                    "name": "<networkDeviceName>",
                    "type": "<networkDeviceType>",
                    "vendor": "<networkDeviceVendor>"
                }
            }
        ],
        "runtime": {
            "operating_system": {
                "name": "<OSName>",
                "version": "<OSVersion>"
            },
            "role": "<runtimeRole>"
        },
        "formfactor": {
            "formfactor": "<formfactor>",
            "rackunits": <rackunits>
        }
    },
    "ipxe": false
}

\<name> (STRING) - Name of the client. Default: Client_uuid or Server_uuid\ \<parentIds> (List of INTs) - Ids of the groups the client gets added to\ \<type> (STRING) - CLIENT or SERVER\ \<uuid> (STRING) - UUID of the client\ \<purpose> (STRING) - The purpose of the client

contacts - A list of the assigned administrators\ \<lastName> (STRING) - First name of the contact\ \<firstName> (STRING) - Last name of the contact

location (Server only) - Specific location information like rackslot and bay for servers\ \<bay> (INT) - null, undefined or \<insertion> (STRING) - Front, Back, or Front and backside\ \<option> - Horizontal or Vertical\ \<slot> -

\<networkd> - \<mac> - Mac address of the client\ \<ip> - IP address of the client\ \<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