Work Orders

Work Orders are tasks assigned to Drivers and is paired with an existing Job Site. Work Orders contain information regarding the status of the task, the time spent for the it and Media files and comments associated with it.

Fields

Tag Data Type Required Description
accountId Long No The id of the Account that owns this record.
actualStartTime Text No Date and time stamp indicating when work began.
Note: Format is in timestamp and timezone (YYYY-MM-DDTHH:MM:SS.sssZ, e.g: 1970-01-01T00:00:00.000Z)
actualStopTime Text No Date and time stamp indicating when work was completed.
Note: Format is in timestamp and timezone (YYYY-MM-DDTHH:MM:SS.sssZ, e.g: 1970-01-01T00:00:00.000Z)
comment Text (unlimited) No Additional notes about the work to be performed
completedTime Text No Target completion time for work order 
Note: Format is in timestamp and timezone (YYYY-MM-DDTHH:MM:SS.sssZ, e.g: 1970-01-01T00:00:00.000Z)
deletedAt Text No Timestamp of when the work order was soft deleted. This is not returned for records that have not been deleted.
Note: Format is in timestamp and timezone (YYYY-MM-DDTHH:MM:SS.sssZ, e.g: 1970-01-01T00:00:00.000Z)
description Text (unlimited) No Text overview of Work Order  
fields Object No Collection of default and custom field values in the record. 
id Auto-incremented Long Auto Unique identifier 
jobSiteId Long Yes ID of the Job Site where this Work Order is to be performed.
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)
media Array  No Collection of Media files attached to the Work Order Report
requestedStartTime Text No Target start time for work order 
Note: Format is in timestamp and timezone (YYYY-MM-DDTHH:MM:SS.sssZ, e.g: 1970-01-01T00:00:00.000Z)
signature Text (unlimited) No BLOB of the User’s signature 
totalTimeWorked Text No Total time spent by user on Work Order
Note: Must be in seconds Duration format (PT##S). Where ## is the number of seconds (see examples)
userId Long No Id of the User assigned to perform this Work Order.
viewTimestamp Text No Date and time stamp indicating when work was viewed by user.
Note: Format is in timestamp and timezone (YYYY-MM-DDTHH:MM:SS.sssZ, e.g: 1970-01-01T00:00:00.000Z)

Read

Create

Update

Update with attachments

API PATH: /api/v2/workOrders?_method=PUT
METHOD: POST
EXAMPLE REQUEST:

To update and complete a work order with attachments and send an email notification, the request must be a multipart.

Header

Content-Type: multipart/form-data; boundary=-------------------------acebdf13572468
User-Agent: Fiddler
Authorization: Basic [base64_Credentials]
Host: staging.vistracks.com

Body

-----------------------------acebdf13572468
Content-Disposition: form-data; name="json"

[
  {
    "description": "Work Order 1",
    "userId": 1253461,
    "jobSiteId": 37133,
    "comment": "Work order report",
    "actualStartTime": "2018-06-11T12:00:00.000Z",
    "actualStopTime": "2018-06-11T12:10:00.000Z",
    "completedTime": "2018-06-11T12:10:00.000Z",
    "requestedStartTime": "2018-06-11T12:00:00.000Z",
    "viewTimestamp": "2018-06-11T12:00:00.000Z",
    "signature": "BLOB value of signature",
    "totalTimeWorked": "PT600.0S",
    "fields": {
      "__WORK_ORDER_ON_DEVICE": "true"
    },
    "media": [],
    "id": 21299
  }
] 
---------------------------acebdf13572468
Content-Disposition: form-data; name="file"; filename="work_order.jpg"
Content-Type: image/jpeg

<@INCLUDE *C:\Users\User\Desktop\work_order.jpg*@>
---------------------------acebdf13572468--
EXAMPLE RESPONSE:
[
  {
    "description": "Work Order 1",
    "userId": 1253461,
    "jobSiteId": 37133,
    "comment": "Work order report",
    "actualStartTime": "2018-06-11T12:00:00.000Z",
    "actualStopTime": "2018-06-11T12:10:00.000Z",
    "completedTime": "2018-06-11T12:10:00.000Z",
    "requestedStartTime": "2018-06-11T12:00:00.000Z",
    "viewTimestamp": "2018-06-11T12:00:00.000Z",
    "signature": "BLOB value of signature",
    "totalTimeWorked": "PT600.0S",
    "fields": {
      "__WORK_ORDER_ON_DEVICE": "true"
    },
    "media": [
      {
        "name": "file",
        "filename": "work_order.jpg",
        "id": 34324
      }
    ],
    "accountId": 1248806,
    "id": 21299,
    "lastChangedDate": "2018-06-11T12:10:00.000Z"
  }
]  

Delete

API error calls

ERROR MESSAGE POSSIBLE CAUSES
JSON read failed: <message> JSON error with the error message
Cannot find requested work order. (id = <id>) PUT error because Work Order id does not exist
The requested work order has been closed and cannot be changed. PUT error because editing a close Work Order is not allowed
Work Order is not assigned to current user anymore. PUT error because the request must contain the correct assigned User