Driver Calcs

Driver Calcs provide the records of calculations conducted to determine a whether a Driver has committed a Driver Violation or not. The information within Driver Calcs includes the Driver, the associated Driver History record from which the calculation is based upon, and the timestamps pertaining to the Driver’s on duty shift.

Fields

Tag Data Type Required Description
accountId Long Auto The id of the Account that owns this record.
breakResetTimestamp Text No Timestamp value of the Driver’s break reset
Note: Format is in timestamp and timezone (YYYY-MM-DDTHH:MM:SS.sssZ, e.g: 1970-01-01T00:00:00.000Z)
cycleResetTimestamp Text No  Timestamp value of the Driver’s cycle reset
Note: Format is in timestamp and timezone (YYYY-MM-DDTHH:MM:SS.sssZ, e.g: 1970-01-01T00:00:00.000Z)
driverHistoryId Long Yes  The id of the Driver History associated with the Driver Calc
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)
shiftResetTimestamp Text No  Timestamp value of the Driver’s shift reset
Note: Format is in timestamp and timezone (YYYY-MM-DDTHH:MM:SS.sssZ, e.g: 1970-01-01T00:00:00.000Z)
userId Long Yes The id of the Driver associated with the Driver Calc Record.
violations Object  Yes  A JSON representing a collection of Driver Violations.

 

Read

API PATH: /api/v2/driverCalcs
METHOD: GET
PARAMETERS: user-id – Retrieves matching records for a specific User (e.g. user-id=496650, current User by default)
driver-history-id – Retrieves matching records for a specific Driver History (e.g. driver-history-id=4826715, all Driver Histories by default)
driver-history.from-event-time – Retrieves records whose Driver History ‘s eventTime occurred on or after the specified date. This is must be used together with driver-history.to-event-time. (e.g. driver-history.from-event-time=2018-06-11T12:00:00.000Z)
driver-history.to-event-time – Retrieves records whose Driver History’s eventTime occurred on or before the specified date. This is must be used together with driver-history.from-event-time. (e.g. driver-history.to-event-time=2018-06-11T12:00:00.000Z)
from-change-timestamp – Retrieves records modified since 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
QUERY STRING EXAMPLES: Get the Driver Calc with the specified id: api/v2/driverCalcs/372931
Get all Driver Calc for the specific User : ?user-id=1250941
Get two Driver Calc of the current Account with an offset of 1 : ?offset=1&limit=2
Get all Driver Calc of the current Account sorted by their id in descending: ?sort=-id
EXAMPLE RESPONSE:
[
  {
    "userId": 1250941,
    "driverHistoryId": 4826715,
    "cycleResetTimestamp": null,
    "shiftResetTimestamp": null,
    "breakResetTimestamp": null,
    "violations": {
      "DriverViolations": [
        {
          "message": "You have exceeded your shift duty span limit of 14 hours",
          "timestamp": "2018-06-11T11:00:00.000Z",
          "title": "Duty Span Hours In Shift",
          "drivingRuleType": "SHIFT_ELAPSED_HOURS",
          "toolTipText": "14 Shift Duty Span Hour Violation at 11-Jun-18 11:00",
          "iconLabel": "14"
        }
      ]
    },
    "accountId": 1248280,
    "id": 372931,
    "lastChangedDate": "2018-06-11T12:00:00.000Z"
  }
]

Create

API PATH: /api/v2/driverCalcs
METHOD: POST
EXAMPLE REQUEST:
[
  {
    "userId": 1250941,
    "driverHistoryId": 4826715,
    "cycleResetTimestamp": null,
    "shiftResetTimestamp": null,
    "breakResetTimestamp": null,
    "violations": {
      "DriverViolations": [
        {
          "message": "You have exceeded your shift duty span limit of 14 hours",
          "timestamp": "2018-06-11T11:00:00.000Z",
          "title": "Duty Span Hours In Shift",
          "drivingRuleType": "SHIFT_ELAPSED_HOURS",
          "toolTipText": "14 Shift Duty Span Hour Violation at 11-Jun-18 11:00",
          "iconLabel": "14"
        }
      ]
    },
    "accountId": 1248280
  }
]
EXAMPLE RESPONSE:
[
  {
    "userId": 1250941,
    "driverHistoryId": 4826715,
    "cycleResetTimestamp": null,
    "shiftResetTimestamp": null,
    "breakResetTimestamp": null,
    "violations": {
      "DriverViolations": [
        {
          "message": "You have exceeded your shift duty span limit of 14 hours",
          "timestamp": "2018-06-11T11:00:00.000Z",
          "title": "Duty Span Hours In Shift",
          "drivingRuleType": "SHIFT_ELAPSED_HOURS",
          "toolTipText": "14 Shift Duty Span Hour Violation at 11-Jun-18 11:00",
          "iconLabel": "14"
        }
      ]
    },
    "accountId": 1248280,
    "id": 372931,
    "lastChangedDate": "2018-06-11T12:00:00.000Z"
  }
]

Update

API PATH: /api/v2/driverCalcs
METHOD: PUT
EXAMPLE REQUEST:
[
  {
    "userId": 1250941,
    "driverHistoryId": 4826715,
    "cycleResetTimestamp": null,
    "shiftResetTimestamp": null,
    "breakResetTimestamp": null,
    "violations": {
      "DriverViolations": [
        {
          "message": "You have exceeded your shift duty span limit of 14 hours",
          "timestamp": "2018-06-11T11:00:00.000Z",
          "title": "Duty Span Hours In Shift",
          "drivingRuleType": "SHIFT_ELAPSED_HOURS",
          "toolTipText": "14 Shift Duty Span Hour Violation at 11-Jun-18 11:00",
          "iconLabel": "14"
        }
      ]
    },
    "accountId": 1248280,
    "id": 372931
  }
]
EXAMPLE RESPONSE:
[
  {
    "userId": 1250941,
    "driverHistoryId": 4826715,
    "cycleResetTimestamp": null,
    "shiftResetTimestamp": null,
    "breakResetTimestamp": null,
    "violations": {
      "DriverViolations": [
        {
          "message": "You have exceeded your shift duty span limit of 14 hours",
          "timestamp": "2018-06-11T11:00:00.000Z",
          "title": "Duty Span Hours In Shift",
          "drivingRuleType": "SHIFT_ELAPSED_HOURS",
          "toolTipText": "14 Shift Duty Span Hour Violation at 11-Jun-18 11:00",
          "iconLabel": "14"
        }
      ]
    },
    "accountId": 1248280,
    "id": 372931,
    "lastChangedDate": "2018-06-11T12:00:00.000Z"
  }
]

Delete

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