Mobile API V2
Mobile API V2
API v2 routes are stateless JWT routes under /api/v2. They use Auth0Authenticator and UserProvider through the api firewall.
Electrician API
Controller: app/src/Controller/Api/V2/ElectricianController.php
Base route: /api/v2/electrician
Important endpoints:
| Endpoint | Purpose |
|---|---|
GET /me | Current electrician profile/context. |
GET /clients | Assigned/scoped clients. |
GET /projects | Assigned projects. |
GET /projects/{id} | Project detail. |
POST /projects/{id}/distance | Project distance/geofence style check. |
GET /projects/{id}/cost-codes | Cost-code list used for validation. |
GET /timesheets | List timesheets. |
POST /timesheets | Create or update weekly timesheet from entries[]. |
POST/PATCH /timesheets/{id} | Update existing timesheet. |
GET /expenses | List expenses. |
POST /expenses | Create expense. |
POST/PATCH /expenses/{id} | Update expense. |
Supervisor API
Controller: app/src/Controller/Api/V2/SupervisorController.php
Base route: /api/v2/supervisor
Important endpoints:
| Endpoint | Purpose |
|---|---|
GET /me | Current supervisor profile/context. |
GET /projects | Supervised projects. |
GET /timesheets | Timesheets pending/available for review. |
GET /expenses | Expenses pending/available for review. |
POST/PATCH /timesheets/{id}/approve | Approve/accept timesheet. |
POST/PATCH /timesheets/{id}/reject | Reject timesheet. |
POST/PATCH /timesheets/{id}/cost-codes | Update cost-code data. |
POST/PATCH /expenses/{id}/approve | Approve/accept expense. |
POST/PATCH /expenses/{id}/reject | Reject expense. |
POST/PATCH /expenses/{id}/resubmit | Resubmit expense where supported. |
Payload notes
Timesheet V2 payloads use entries[]. Each entry can carry allowances, materials, work conditions, and material stock confirmation. Cost codes are validated against the selected project's client cost-code list.
When the project primary address has radius validation enabled, submitted timesheets must include locationMeta.latitude and locationMeta.longitude; submissions outside the configured radius return 422 and are not saved as submitted.