Admin API Specification
This document outlines the API endpoints for the admin portal.
Summary
| Resource | Create/Update | Get All | Get One | Delete |
|---|---|---|---|---|
| Users | POST /api/users | GET /api/users | GET /api/users/{id} | DELETE /api/users/{id} |
| Projects | POST /api/projects | GET /api/projects | GET /api/projects/{id} | DELETE /api/projects/{id} |
| Sites | POST /api/sites | GET /api/sites | GET /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
AuthUserorWorkerUserobject. Theidis optional for creation.
An AuthUser object would look like this:
{
"id": "string",
"name": "string",
"mobile": "string",
"company": "string",
"email": "string",
"type": "Admin"
}A WorkerUser object would look like this:
{
"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 ofUserobjects.
GET /api/users/{id}
Retrieves a single user by their ID.
- Method:
GET - Path:
/api/users/{id} - Responses:
200 OK: Returns aUserobject.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
Projectobject. Theidis optional for creation.
{
"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 benullif 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 ofProjectobjects.
GET /api/projects/{id}
Retrieves a single project by its ID.
- Method:
GET - Path:
/api/projects/{id} - Responses:
200 OK: Returns aProjectobject.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
Siteobject. Theidis optional for creation.
{
"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 ofSiteobjects.
GET /api/sites/{id}
Retrieves a single site by its ID.
- Method:
GET - Path:
/api/sites/{id} - Responses:
200 OK: Returns aSiteobject.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.