Driver Violation Documents

Driver Violation Documents is use to upload HOS Driver Violation – Action Report to support and acknowledged the Driver Violations recorded from the HOS App.

Fields

Tag Data Type Required Description
accountId Long No The id of the Account that owns this record.
changedBy Text Auto The name of the User who made the last change to this record
driverViolationId Long Yes Id of the Driver Violation associated with the Document. 
id Auto-incremented Long Auto Unique Identifier
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)
note Text (unlimited) No Notes/Details about the Document.
media Array No Contains the PDF(s) of the Driver Violation Document
userId Long Yes Id of the User associated with the Driver Violation Document.

Read

API PATH: /api/v2/driverViolationDocuments/
METHOD: GET
PARAMETERS: driver-violation-id – Retrieves records associated with the supplied Driver Violation (e.g. driver-violation-id=2104043, all Driver Violations by default).
from-change-timestamp – Retrieves matching records that were changed after the specified timestamp (e.g. from-change-timestamp=2016-07-05T23:54:41.451Z, all timestamps by default)
to-change-timestamp – Retrieves matching records that were changed before the specified timestamp (e.g. to-change-timestamp=2018-06-11T12:00:00.000Z, REQUIRES to-change-timestamp)
offset – Retrieves matching records after an offset value (e.g. offset=2, zero offset by default)
limit – Retrieves a number of records per page specified by the value (e.g. limit=10, all records by default)
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=last-changed-date– Sort records by their last change date field in ascending order
sort=-last-changed-date– Sort records by their last change date field in descending order
QUERY STRING EXAMPLES: Get the Driver Violation Document with the specified id: api/v2/driverViolationDocuments/90
Get all Driver Violation Documents of the current Account associated with the Driver Violation id 2104043 : ?driver-violation-id=2104043 
Get two Driver Violation Documents of the current Account with an offset of 1 : ?offset=1&limit=2
EXAMPLE RESPONSE:
[
  {
    "userId": 1252375,
    "driverViolationId": 2135113,
    "note": "Acknowledged",
    "media": [
      {
        "name": "2135113",
        "filename": "runreport.pdf",
        "isParent": false,
        "accountId": 1248446,
        "id": 5362
      }
    ],
    "accountId": 1248446,
    "id": 90,
    "changedBy": "Admin A",
    "lastChangedDate": "2018-06-11T12:00:00.000Z"
  }
]

Create

API PATH: /api/v2/driverViolationDocuments/
METHOD: POST
EXAMPLE REQUEST:

To create add a Driver Violation Document. The request must be a multipart. 
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": 1252375,
    "driverViolationId": 2135113,
    "note": "Acknowledged",
    "media": []
  }
]

---------------------------acebdf13572468
Content-Disposition: form-data; name="2135113"; filename="runreport.pdf"
Content-Type: application/kswps

<@INCLUDE *C:\Users\Marc\Desktop\runreport.pdf*@>
---------------------------acebdf13572468--
EXAMPLE RESPONSE:
[
  {
    "userId": 1252375,
    "driverViolationId": 2135113,
    "note": "Acknowledged",
    "media": [
      {
        "name": "2135113",
        "filename": "runreport.pdf",
        "isParent": false,
        "accountId": 1248446,
        "id": 5362
      }
    ],
    "accountId": 1248446,
    "id": 90,
    "changedBy": "Admin A",
    "lastChangedDate": "2018-06-11T12:00:00.000Z"
  }
]

Update

API PATH: /api/v2/driverViolationDocuments/
METHOD: PUT
EXAMPLE REQUEST:
[
  {
    "userId": 1252159,
    "driverViolationId": 2120242,
    "note": "Form",
    "media": []
    "id": 90
  }
]
EXAMPLE RESPONSE:
[
  {
    "userId": 1252159,
    "driverViolationId": 2120242,
    "note": "Form",
    "media": [],
    "accountId": 1248413,
    "id": 90,
    "changedBy": "Admin A",
    "lastChangedDate": "2018-06-11T12:00:00.000Z"
  }
]

Delete

API PATH: /api/v2/driverViolationDocuments/<id>
METHOD: DELETE

API error calls

ERROR MESSAGE POSSIBLE CAUSES
JSON read failed: <error> JSON error with the error message