Skip to content

Admin API Specification ​

This document outlines the API endpoints for the admin portal.

Summary ​

ResourceCreate/UpdateGet AllGet OneDelete
UsersPOST /api/usersGET /api/usersGET /api/users/{id}DELETE /api/users/{id}
ProjectsPOST /api/projectsGET /api/projectsGET /api/projects/{id}DELETE /api/projects/{id}
SitesPOST /api/sitesGET /api/sitesGET /api/sites/{id}DELETE /api/sites/{id}

The Create and Update operations for each resource are handled by a single POST endpoint. If an id is provided in the request body, the corresponding entity will be updated (upsert). If no id is provided, a new entity will be created.

Users ​

Endpoints for managing users.

POST /api/users ​

Creates a new user or updates an existing one.

  • Method: POST
  • Path: /api/users
  • Body: A AuthUser or WorkerUser object. The id is optional for creation.

An AuthUser object would look like this:

json
{
  "id": "string",
  "name": "string",
  "mobile": "string",
  "company": "string",
  "email": "string",
  "type": "Admin"
}

A WorkerUser object would look like this:

json
{
  "id": "string",
  "name": "string",
  "mobile": "string",
  "company": "string",
  "email": "string", // optional
  "type": "Worker"
}

Note: The type field can be one of Admin, RPO, SiteProtector, Viewer for AuthUser and Worker or Visitor for WorkerUser. For WorkerUser, the email field is optional and may be omitted; it may be used for onboarding in the future if provided.

  • Responses:
    • 201 Created: If a new user was created.
    • 200 OK: If an existing user was updated.

GET /api/users ​

Retrieves a list of all users.

  • Method: GET
  • Path: /api/users
  • Responses:
    • 200 OK: Returns an array of User objects.

GET /api/users/{id} ​

Retrieves a single user by their ID.

  • Method: GET
  • Path: /api/users/{id}
  • Responses:
    • 200 OK: Returns a User object.
    • 404 Not Found: If the user is not found.

DELETE /api/users/{id} ​

Deletes a user by their ID.

  • Method: DELETE
  • Path: /api/users/{id}
  • Responses:
    • 204 No Content: If the user was deleted successfully.
    • 404 Not Found: If the user is not found.

Projects ​

Endpoints for managing projects.

POST /api/projects ​

Creates a new project or updates an existing one.

  • Method: POST
  • Path: /api/projects
  • Body: A Project object. The id is optional for creation.
json
{
  "id": "string",
  "name": "string",
  "blockings": [
    {
      "name": "string",
      "trackDirection": null,
      "location": "string"
    }
  ],
  "siteIds": ["string"],
  "rpoId": "string",
  "isActive": false,
  "startTime": "string",
  "endTime": "string"
}

Field notes:

  • trackDirection - string | null. May be null if the blocking does not apply to a specific track direction.

  • Responses:

    • 201 Created: If a new project was created.
    • 200 OK: If an existing project was updated.

GET /api/projects ​

Retrieves a list of all projects.

  • Method: GET
  • Path: /api/projects
  • Responses:
    • 200 OK: Returns an array of Project objects.

GET /api/projects/{id} ​

Retrieves a single project by its ID.

  • Method: GET
  • Path: /api/projects/{id}
  • Responses:
    • 200 OK: Returns a Project object.
    • 404 Not Found: If the project is not found.

DELETE /api/projects/{id} ​

Deletes a project by its ID.

  • Method: DELETE
  • Path: /api/projects/{id}
  • Responses:
    • 204 No Content: If the project was deleted successfully.
    • 404 Not Found: If the project is not found.

Sites ​

Endpoints for managing sites.

POST /api/sites ​

Creates a new site or updates an existing one.

  • Method: POST
  • Path: /api/sites
  • Body: A Site object. The id is optional for creation.
json
{
  "id": "string",
  "name": "string",
  "description": "string",
  "limitStart": "string",
  "limitEnd": "string",
  "isActive": false,
  "isProtected": false,
  "isHandoverEnabled": false,
  "protectorId": "string",
  "safePlace": "string"
}
  • Responses:
    • 201 Created: If a new site was created.
    • 200 OK: If an existing site was updated.

GET /api/sites ​

Retrieves a list of all sites.

  • Method: GET
  • Path: /api/sites
  • Responses:
    • 200 OK: Returns an array of Site objects.

GET /api/sites/{id} ​

Retrieves a single site by its ID.

  • Method: GET
  • Path: /api/sites/{id}
  • Responses:
    • 200 OK: Returns a Site object.
    • 404 Not Found: If the site is not found.

DELETE /api/sites/{id} ​

Deletes a site by its ID.

  • Method: DELETE
  • Path: /api/sites/{id}
  • Responses:
    • 204 No Content: If the site was deleted successfully.
    • 404 Not Found: If the site is not found.

Internal use only