Skip to content

Maintenance

This document provides detailed information about the Maintenance Handler API endpoints.



Service History

Data Schema

Property Type Required Description
title string Yes Title of the service record.
vehicleId string Yes ID of the vehicle serviced.
serviceDate datetime Yes Date and time of service.
odometer double Yes Vehicle odometer reading.
userId string Yes ID of user who created record.
providerName string No Name of service provider.
location string No Location where service was performed.
expenditure double No Cost of service.
notes string No Additional service notes.
fileIds string[] No Array of attached file IDs.
serviceTasks string[] No List of performed tasks.
$id string auto Unique identifier for the record.
$createdAt datetime auto Record creation timestamp.
$updatedAt datetime auto Last update timestamp.

List Records

GET /history

Description : List all previous maintenance history data

Curl Example

curl -X GET "https://api.trackongps.com/api2/services/history" \
  -H "Cookie: JSESSIONID=session_id"

Responses

200 OK - Example Response
{
  "documents": [
    {
      "id": "service123",
      "title": "Oil Change",
      "vehicleId": "vehicle456",
      "serviceDate": "2024-01-01T10:00:00Z",
      "odometer": 12000,
      "providerName": "ABC Auto Service",
      "location": "New York, NY",
      "expenditure": 100.0,
      "notes": "Changed engine oil and filter."
    }
  ],
  "pagination": {
    "currentPage": 1,
    "totalPages": 5,
    "totalRecords": 50
  }
}

Get Record

GET /history/{serviceId}

Description: Retrieves a specific service history record by ID.

Curl Example

curl -X GET "https://api.trackongps.com/api2/services/history/service123" \
  -H "Cookie: JSESSIONID=session_id"

Responses

200 OK - Example Response
{
  "id": "service123",
  "title": "Oil Change",
  "vehicleId": "vehicle456",
  "serviceDate": "2024-01-01T10:00:00Z",
  "odometer": 12000,
  "providerName": "ABC Auto Service",
  "location": "New York, NY",
  "expenditure": 100.0,
  "notes": "Changed engine oil and filter."
}

Update Record

PUT /history/{serviceId}

Description: Updates a specific service record with new data.

Curl Example

curl -X PUT "https://api.trackongps.com/api2/services/history/serviceId" \
  -H "Cookie: JSESSIONID=session_id" \
  -H "Content-Type: application/json" \
  -d '{
  "title": "Tire Rotation",
  "serviceDate": "2024-02-10T08:30:00Z",
  "odometer": 15000,
  "notes": "Rotated all four tires."
  }'

Request Body

{
  "title": "Tire Rotation",
  "serviceDate": "2024-02-10T08:30:00Z",
  "odometer": 15000,
  "notes": "Rotated all four tires."
}

Responses

200 OK - Example Response
{
  "message": "Record updated successfully",
}

Create New Record

Description: Creates a new service history record for a vehicle.

POST /history

Curl Example

curl -X POST "https://api.trackongps.com/api2/services/history" \
  -H "Cookie: JSESSIONID=session_id" \
  -H "Content-Type: application/json" \
  -d '{
  "title": "Brake Pad Replacement",
  "vehicleId": "vehicle789",
  "serviceDate": "2024-03-15T09:00:00Z",
  "odometer": 18000,
  "providerName": "XYZ Auto Repairs",
  "location": "Los Angeles, CA",
  "expenditure": 250.0,
  "notes": "Replaced front brake pads.",
  "fileIds": ["3afdafdafd", "fdafdar4afdaf"],
  "serviceTasks": ["Card Wash", "A/C Replcement"]
  }'

Request Body

{
  "title": "Brake Pad Replacement", //required
  "vehicleId": "vehicle789", //required
  "serviceDate": "2024-03-15T09:00:00Z", //required
  "odometer": 18000, //required
  "providerName": "XYZ Auto Repairs",
  "location": "Los Angeles, CA",
  "expenditure": 250.0,
  "notes": "Replaced front brake pads.",
  "fileIds": ["3afdafdafd", "fdafdar4afdaf"],
  "serviceTasks": ["Card Wash", "A/C Replcement"]
}

Responses

201 Created - Example Response
{
  "title": "Brake Pad Replacement", //required
  "vehicleId": "vehicle789", //required
  "serviceDate": "2024-03-15T09:00:00Z", //required
  "odometer": 18000, //required
  "providerName": "XYZ Auto Repairs",
  "location": "Los Angeles, CA",
  "expenditure": 250.0,
  "notes": "Replaced front brake pads.",
  "fileIds": ["3afdafdafd", "fdafdar4afdaf"],
  "serviceTasks": ["Card Wash", "A/C Replcement"]
}

Delete a Record

DELETE /history/{serviceId}

Description: Deletes a specific service history record.

Curl Example

curl -X DELETE "https://api.trackongps.com/api2/services/history/serviceId" \
  -H "Cookie: JSESSIONID=session_id"

Responses

200 OK - Example Response
{
  "message": "Record deleted successfully"
}

Service Task

Data Schema

Property Type Required Description
label string Yes Name of the service task.
userId string auto ID of user who created task.
$id string auto Unique identifier for task.
$createdAt datetime auto Task creation timestamp.
$updatedAt datetime auto Last update timestamp.

Create Task

POST /task

Description: Creates a new service task.

Curl Example

curl -X POST "https://api.trackongps.com/api2/services/task" \
  -H "Cookie: JSESSIONID=session_id" \
  -H "Content-Type: application/json" \
  -d '{
  "label": "Engine Check"
  }'

Request Body

{
  "label": "Engine Check"
}

Responses

201 Created - Example Response
{
  "id": "task123",
  "label": "Engine Check",
  "userId": "12345"
}

Get All Tasks

GET /task

Description: Retrieves all service tasks for the authenticated user and public tasks.

Curl Example

curl -X GET "https://api.trackongps.com/api2/services/task" \
  -H "Cookie: JSESSIONID=session_id"

Responses

200 OK - Example Response
[
  {
    "id": "34adfdafeafda",
    "label": "Engine Check",
    "userId": "12345"
  },
  {
    "id": "12dfafda34afda",
    "label": "Tire Inspection",
    "userId": null
  }
]

Remove Task

DELETE /task

Description: Remove specific service tasks for the authorized item only.

Curl Example

curl -X DELETE "https://api.trackongps.com/api2/services/task" \
  -H "Cookie: JSESSIONID=session_id" \
  -H "Content-Type: application/json" \
  -d '{
  "label": "Engine Check"
  }'

Request Body

{
  "label": "Engine Check"
}

Responses

200 OK - Example Response
{
  "message": "Task deleted"
}