The DVIRs API is used to handle queries for inspections. Drivers would be allowed to query their inspections of each equipment and manage them as a single DVIR until they have been certified.
DVIRs are automatically deleted after a specific period of time following the data retention policy.
Fields
| Tag | Data Type | Required | Description |
| accountId | Long | No | The id of the Account that owns this record. |
| certifyMessage | Character (255) | No | Certification message of the inspector along with the inspector’s name. |
| dvirFormIds | Array | No | A list of DVIR Form ids that belongs to this DVIR. |
| endTime | Text | No | Timestamp when the inspection ended Note: Format is in timestamp and timezone (YYYY-MM-DDTHH:MM:SS.sssZ, e.g: 1970-01-01T00:00:00.000Z) |
| equipmentCondition | equipment_condition | No | Condition of the equipment according to the DVIR. Can either be:
|
| generalComments | Text | No | Comments/Notes for the DVIR |
| id | Auto-incremented Long | Auto | Unique identifier |
| inspectionType | inspection_trip_type | No | Information on the type of DVIR. Can either be:
|
| inspectorType | inspector_type | No | Information on the type of inspector. Can either be:
|
| lastChangedDate | Text | Auto | Auto-generated timestamp of the last change made to this record Note: Format is in timestamp and timezone (YYYY-MM-DDTHH:MM:SS.sssZ, e.g: 1970-01-01T00:00:00.000Z) |
| location | Character (255) | No | The address where the DVIR of the assets occurred. |
| mechanicSignature | Object | No | Contains the id and filename of the image of the mechanic signature associated with the DVIR record |
| odometerKm | Double Precision | No | The odometer value on the time of the DVIR |
| reviewingDriverSignature | Object | No | Contains the id and filename of the image of the reviewing driver signature associated with the DVIR record |
| signatureMediaId / signature | Long / Object | No | On GET, contains the id of the image of the signature associated with the DVIR record (signatureMediaId) On POST, contains an object with the details of the signature of the inspector. (signature) |
| startTime | Text | No | Timestamp when the DVIR started Note: Format is in timestamp and timezone (YYYY-MM-DDTHH:MM:SS.sssZ, e.g: 1970-01-01T00:00:00.000Z) |
| status | inspection_status | No | Information on the status of the DVIR |
| userId | Long | No | The id of the Driver who is using the Equipment being inspected |
Read DVIRS
| API PATH: | /api/v2/dvirs |
| METHOD: | GET |
| PARAMETERS: | to-end-time – Retrieves matching records on or before the specified timestamp (e.g. to-inspection-end-time=2018-06-11T11:55:00.000Z, all timestamps by default) from-end-time – Retrieves matching records on or after the specified timestamp (e.g. from-inspection-end-time=2018-06-11T11:55:00.000Z, all timestamps by default) from-change-timestamp – Retrieves records modified after the timestamp supplied (e.g. from-change-timestamp=2018-06-11T12:00:00.000Z) to-change-timestamp – Retrieves records modified before the timestamp supplied (e.g. to-change-timestamp=2018-06-11T12:00:00.000Z, REQUIRES from-change-timestamp) offset – Retrieves matching records after an offset value (e.g. offset=2) limit – Retrieves a number of records per page specified by the value (e.g. limit=10) |
| SORTING: | sort=id – Sort records by their id field in ascending order (DEFAULT) sort=-id – Sort records by their id field in descending order sort=end-time – Sort records by their id field in ascending order sort=-end-time – Sort records by their id field in descending order |
| QUERY STRING EXAMPLES: | Get the DVIR record with the specified id: api/v2/dvirs/50372 Get two DVIR records of the current Account with an offset of 1 : ?offset=1&limit=2 |
| EXAMPLE RESPONSE: |
[
{
"userId": 1253185,
"startTime": "2018-06-11T11:30:00.000Z",
"endTime": "2018-06-11T11:55:00.000Z",
"status": "CERTIFIED",
"inspectionType": "PRE_TRIP",
"inspectorType": "DRIVER",
"location": "1mi N St. John's, 5",
"odometerKm": 78.3,
"certifyMessage": "I, John Doe, certify that this DVIR is correct and true.",
"generalComments": "GENERAL COMMENTS",
"equipmentCondition": "DEFECTS_CORRECTED",
"mechanicSignature": {
"name": "MechSig.jpg",
"filename": "MechSig.jpg",
"id": 21485427
},
"reviewingDriverSignature": {
"name": "RevDriverSig.jpg",
"filename": "RevDriverSig.jpg",
"id": 21485428
},
"signatureMediaId": 46675,
"dvirFormIds": [
44863,
44862
],
"accountId": 1248697,
"id": 50372,
"lastChangedDate": "2018-06-11T12:00:00.000Z"
}
]
|
Create DVIRs
| API PATH: | /api/v2/dvirs |
| METHOD: | POST |
| PREREQUISITE: | Must POST one or more inspections using the api/v2/dvirForms endpoint and use the id/s in the list of “dvirForms” field. |
| OPTIONAL: | DVIR can also be created using a multi-part request containing the inspector’s signature and its details. |
| EXAMPLE REQUEST: |
Header Content-Type: multipart/form-data; boundary=-------------------------acebdf13572468 User-Agent: Fiddler Authorization: Basic [base64_Credentials] Host: eld.azuga.com Body -----------------------------acebdf13572468
Content-Disposition: form-data; name="json"
[
{
"userId": 1253185,
"startTime": "2018-06-11T11:30:00.000Z",
"endTime": "2018-06-11T11:55:00.000Z",
"status": "CERTIFIED",
"inspectionType": "PRE_TRIP",
"inspectorType": "DRIVER",
"location": "1mi N St. John's, 5",
"odometerKm": 78.3,
"certifyMessage": "I, John Doe, certify that this DVIR is correct and true.",
"generalComments": "GENERAL COMMENTS",
"equipmentCondition": "DEFECTS_CORRECTED",
"signature": {
"name": "signature",
"filename": "signature01.png"
},
"mechanicSignature": {
"name": "MechSig.jpg",
"filename": "MechSig.jpg"
},
"reviewingDriverSignature": {
"name": "RevDriverSig.jpg",
"filename": "RevDriverSig.jpg"
},
"dvirFormIds": [
44863,
44862
]
}
]
---------------------------acebdf13572468
Content-Disposition: form-data; name="signature01.png"; filename="signature01.png"
Content-Type: image/png
<@INCLUDE *C:\Users\Marc\Desktop\signature01.png*@>
---------------------------acebdf13572468
Content-Disposition: form-data; name="MechSig.jpg"; filename="MechSig.jpg"
Content-Type: image/jpeg
<@INCLUDE *C:\Users\Marc\Desktop\MechSig.jpg*@>
---------------------------acebdf13572468
Content-Disposition: form-data; name="RevDriverSig.jpg"; filename="RevDriverSig.jpg"
Content-Type: image/jpeg
<@INCLUDE *C:\Users\Marc\Desktop\RevDriverSig.jpg*@>
---------------------------acebdf13572468--
|
| EXAMPLE RESPONSE: |
[
{
"userId": 1253185,
"startTime": "2018-06-11T11:30:00.000Z",
"endTime": "2018-06-11T11:55:00.000Z",
"status": "CERTIFIED",
"inspectionType": "PRE_TRIP",
"inspectorType": "DRIVER",
"location": "1mi N St. John's, 5",
"odometerKm": 78.3,
"certifyMessage": "I, John Doe, certify that this DVIR is correct and true.",
"generalComments": "GENERAL COMMENTS",
"equipmentCondition": "DEFECTS_CORRECTED",
"signatureMediaId": 46675,
"mechanicSignature": {
"name": "MechSig.jpg",
"filename": "MechSig.jpg",
"id": 21485427
},
"reviewingDriverSignature": {
"name": "RevDriverSig.jpg",
"filename": "RevDriverSig.jpg",
"id": 21485428
},
"dvirFormIds": [
44863,
44862
],
"accountId": 1248697,
"id": 50372,
"lastChangedDate": "2018-06-11T12:00:00.000Z"
}
]
|
Delete
| API PATH: | /api/v2/dvirs/<id> |
| METHOD: | DELETE |
API error calls
| ERROR MESSAGE | POSSIBLE CAUSES |
| DVIR Form is already being used by another DVIR | POST/PUT error because a DVIR form id is already being used in another DVIR record. |
| Same signature already found in an existing DVIR. | POST error because signatureMediaId is already associated with another DVIR record. |