Documents
Base URL
- Bas path
/api2/documents
.
Authorization
- Requires
Cookie
:JSESSIONID=session_id
Data Schema
A document object contains the following fields:
Field | Type | Default | Required | Description |
---|---|---|---|---|
documentOf | string | - | Yes | Type of entity the document belongs to (e.g., "vehicle", "driver") |
entityId | string | - | Yes | ID of the related entity |
documentType | string | - | Yes | Type of document (e.g., "insurance", "license") |
identifiedBy | string | - | No | Name of person who identified the document |
identificationNo | string | - | No | Document identification number |
VIN | string | - | No | Vehicle Identification Number |
description | string | - | No | Document description |
status | string | - | No | Current status of the document |
amount | number | - | No | Associated amount if applicable |
address | string | - | No | Address related to the document |
issuedBy | string | - | No | Authority that issued the document |
issuedDate | ISO8601 date | - | No | Date when document was issued |
expiryDate | ISO8601 date | - | No | Document expiration date |
renewalDate | ISO8601 date | - | No | Date for document renewal |
notes | string | - | No | Additional notes about the document |
fileIds | array[string] | - | No | Array of associated file IDs |
userId | string | - | Auto | ID of the user who owns the document |
$id | string | - | Auto | Unique document identifier |
$createdAt | ISO8601 date | - | Auto | Document creation timestamp |
$updatedAt | ISO8601 date | - | Auto | Last update timestamp |
List Documents
- Endpoint:
GET /
- Description: Retrieves all documents belonging to the authenticated user.
Example Request:
curl -X GET "https://api.trackongps.com/api2/documents" \
-H "Cookie: JSESSIONID=your_session_id"
200 OK - Example Response
{
"total": 12,
"documents": [
{
"documentOf": "vehicle",
"entityId": "685",
"documentType": "insurance",
"identificationNo": "test-number",
"issuedBy": "123",
"issuedDate": "2024-10-17T00:00:00.000+00:00",
"expiryDate": "2024-10-09T00:00:00.000+00:00",
"notes": "testnote22",
"fileIds": ["6731cdfa000c1a67a32d"],
"$id": "671f1cb0002329e3d3bf",
"$createdAt": "2024-10-28T05:10:08.584+00:00",
"$updatedAt": "2024-12-22T10:22:32.210+00:00"
}
// ... more documents
]
}
Get Document
- Endpoint:
GET /:docId
- Description: Retrieves a specific document.
Example Request:
curl -X GET "https://api.trackongps.com/api2/documents/671f1cb0002329e3d3bf" \
-H "Cookie: JSESSIONID=your_session_id"
200 OK - Example Response
{
"documentOf": "vehicle",
"entityId": "685",
"documentType": "insurance",
"issuedDate": "2024-10-17T00:00:00.000+00:00",
"expiryDate": "2024-10-09T00:00:00.000+00:00",
"notes": "test note",
"$id": "671f1cb0002329e3d3bf",
"$createdAt": "2024-10-28T05:10:08.584+00:00",
"$updatedAt": "2024-12-22T10:22:32.210+00:00"
}
Update Document
- Endpoint:
PUT /:docId
- Description: Updates an existing document.
Example Request:
curl -X PUT "https://api.trackongps.com/api2/documents/671f1cb0002329e3d3bf" \
-H "Cookie: JSESSIONID=your_session_id" \
-H "Content-Type: application/json" \
-d '{
"documentType": "insurance",
"issuedDate": "2024-10-17T00:00:00.000+00:00",
"expiryDate": "2024-10-09T00:00:00.000+00:00",
"notes": "Updated insurance details"
}'
Request Body
{
"documentOf": "vehicle", // Required - Type of entity (e.g., "vehicle", "driver")
"entityId": "685", // Required - ID of related entity
"documentType": "insurance", // Required - Type of document
"identifiedBy": "John Doe", // Optional - Person who identified document
"identificationNo": "DOC123", // Optional - Document ID number
"VIN": "1HGCM82633A123456", // Optional - Vehicle ID Number
"description": "Vehicle insurance document", // Optional
"status": "active", // Optional - Document status
"amount": 1000.0, // Optional - Associated amount
"address": "123 Street, City", // Optional - Related address
"issuedBy": "Insurance Co", // Optional - Issuing authority
"issuedDate": "2024-01-01T00:00:00Z", // Optional - Issue date
"expiryDate": "2024-12-31T00:00:00Z", // Optional - Expiry date
"renewalDate": "2024-11-30T00:00:00Z", // Optional - Renewal date
"notes": "Annual insurance policy", // Optional - Additional notes
"fileIds": ["123abc", "456def"] // Optional - Associated file IDs
}
200 OK - Example Response
{
"documentOf": "vehicle",
"entityId": "685",
"documentType": "insurance",
"issuedDate": "2024-10-17T00:00:00.000+00:00",
"expiryDate": "2024-10-09T00:00:00.000+00:00",
"notes": "Updated insurance details",
"$id": "671f1cb0002329e3d3bf",
"$updatedAt": "2024-12-22T10:22:32.210+00:00"
}
Delete Document
- Endpoint:
DELETE /:docId
- Description: Deletes a specific document and its associated files.
Example Request:
curl -X DELETE "https://api.trackongps.com/api2/documents/671f1cb0002329e3d3bf" \
-H "Cookie: JSESSIONID=your_session_id"
200 OK - Example Response
{
"message": "Document deleted successfully",
"documentId": "671f1cb0002329e3d3bf"
}
Expiry Info
- Endpoint:
GET /expiry-info
- Description: Fetches expiry information for all documents.
Example Request:
curl -X GET "https://api.trackongps.com/api2/documents/expiry-info" \
-H "Cookie: JSESSIONID=your_session_id"
200 OK - Example Response
{
"total": 2,
"documents": [
{
"$id": "671f1cb0002329e3d3bf",
"$createdAt": "2024-10-28T05:10:08.584+00:00",
"$updatedAt": "2024-12-22T10:22:32.210+00:00",
"documentOf": "vehicle",
"documentType": "insurance",
"expiryDate": "2024-10-09T00:00:00.000+00:00",
"issuedDate": "2024-10-17T00:00:00.000+00:00"
}
]
}