API reference - TheBigBangTeam/Alohomora-3FA GitHub Wiki

ADMIN API route: /api/admin

To use this route you need a bearer token and send it via an Authorization header like this: 'Authorization':'Bearer ${token}'

  • GET /users - Returns all users data
  • GET /users/:id - Get a specific user data by ID
  • POST /users - Creates a user It needs a body (JSON or x-www-form-urlencoded) with the following parameters: {username, name, surname, email, password, privileges, pin, rfidTag}
  • PUT /users/:id - Updates a specific user It needs a body (JSON or x-www-form-urlencoded) with the parameters to change from this list: {username, name, surname, email, password, privileges, pin, rfidTag}
  • DELETE /users/:id - Deletes a specific user

  • POST /devices - Creates a new device It needs a body (JSON or x-www-form-urlencoded) with the following parameters: {building, description, functionality}
  • GET /devices - Returns all devices data
  • GET /devices/:id - Returns a specific device data by ID
  • PUT /devices/:id - Updates a device It needs a body (JSON or x-www-form-urlencoded) with the following parameters: {building, description, functionality}
  • DELETE /devices/:id - Deletes a specific API by it's ID

AUTHENTICATION API route: /api/authenticate

To use this route you need a bearer token to Authenticate the Device and send it via an Authorization header like this:'Authorization':'Bearer ${token}'

  • GET /:rfid - Sends request to unlock PIN
  • GET /:rfid/:pin - Sends request to unlock the Door

LOGS API route: /api/logs

To use this route you need a bearer token to Authenticate the User and send it via an Authorization header like this:'Authorization':'Bearer ${token}'

  • GET / - Gets all logs

STATISTICS API route: /api/stats

To use this route you need a bearer token to Authenticate the User and send it via an Authorization header like this:'Authorization':'Bearer ${token}'

  • GET / - Gets all statistics

USER API route: /api/user

  • GET / - Gets self info, you need a Authorization header like this: 'Authorization':'Bearer ${token}'
  • POST / - Logins user It needs a body (JSON or x-www-form-urlencoded) with the following parameters: {username,password}