Skip to content

ShaloTrack API v0.1.0

Pre-release
Pre-release

Choose a tag to compare

@SwenJay SwenJay released this 02 Jul 06:24
· 90 commits to main since this release

Endpoint Reference

Author: Suwen Jayathunga — Lead Architect, ShaloTrack Lanka

All endpoints return an ApiResponse<T> envelope. The HTTP status code matches ApiResponse.StatusCode.

Swagger UI is available at /swagger in the Development environment.


Customer Module — /api/customers

GET /api/customers

Retrieve all customers, ordered alphabetically by full name.

Request: No body, no parameters.

Response 200 OK:

{
  "success": true,
  "statusCode": 200,
  "message": "Customers retrieved successfully.",
  "data": [
    {
      "customerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "fullName": "Amal Perera",
      "email": "amal@example.com",
      "phoneNumber": "+94771234567",
      "nicNumber": "199012345678",
      "address": "123 Galle Road, Colombo 3",
      "profileImage": null,
      "accountStatus": 0,
      "vehicleCount": 2
    }
  ],
  "errors": null,
  "timestamp": "2025-01-10T14:23:05Z"
}

Notes:

  • Uses AsNoTracking() — read-only, no change tracking overhead
  • vehicleCount is always 0 for this endpoint — GetAllAsync() does not include the Vehicles navigation property. Only GetByIdAsync uses .Include(c => c.Vehicles)
  • Returns an empty list (not 404) if no customers exist

GET /api/customers/{customerId}

Retrieve a single customer by UUID, including their associated vehicles.

Path parameter: customerId — GUID

Response 200 OK:

{
  "success": true,
  "statusCode": 200,
  "message": "Customer retrieved successfully.",
  "data": {
    "customerId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "fullName": "Amal Perera",
    "email": "amal@example.com",
    "phoneNumber": "+94771234567",
    "nicNumber": "199012345678",
    "address": "123 Galle Road, Colombo 3",
    "profileImage": null,
    "accountStatus": 0,
    "vehicleCount": 2
  },
  "errors": null,
  "timestamp": "2025-01-10T14:23:05Z"
}

Response 404 Not Found:

{
  "success": false,
  "statusCode": 404,
  "message": "Customer not found.",
  "data": null,
  "errors": ["No customer exists with ID '3fa85f64-5717-4562-b3fc-2c963f66afa6'."],
  "timestamp": "2025-01-10T14:23:05Z"
}

POST /api/customers

Create a new customer. The customer is created with AccountStatus = Active.

Request body (CreateCustomerDto):

{
  "fullName": "Amal Perera",
  "email": "amal@example.com",
  "phoneNumber": "+94771234567",
  "nicNumber": "199012345678",
  "address": "123 Galle Road, Colombo 3"
}

Field validation:

Field Required Max length Format
fullName 150
email 150 Valid email address
phoneNumber 20 Valid phone number
nicNumber 20
address 300

Planned Endpoints (Not Yet Implemented)

These route prefixes are defined in the existing README architecture but have no controllers yet:

/api/auth          Authentication (login, logout, refresh token)
/api/vehicles      Vehicle management
/api/devices       GPS device management
/api/tracking      Current location, tracking history, route playback
/api/trips         Trip analysis
/api/alerts        Alert history
/api/subscriptions Subscription management
/api/admin         Administrative operations
/api/dealers       Dealer operations