DVIR Reports

DVIR Reports is used to upload a PDF report after accomplishing an inspection on an Equipment and downloading the uploaded DVIR reports.

Read

API PATH: /api/v2/dvirReports
METHOD: GET
PARAMETERS: dvir-timestamp – [REQUIRED] Retrieves the DVIR Report based on the timestamp specified.
dvir-type – [REQUIRED] Retrieves the DVIR Report based on the DVIR type specified.
user-id – [ONLY for User Admin and higher] Retrieves the DVIR Report of the User specified. If authenticated User does not have User Admin Permissions, the User’s own DVIR Report log is returned.
QUERY STRING EXAMPLES: Get the User’s own DVIR Report on the specified timestamp and DVIR type: api/v2/dvirReports??dvir-timestamp=2017-02-20T00:00:00&dvir-type=pre-trip
Get the specified User’s DVIR Report on the specified date (works for User Admin only) : api/v2/dvirReports?dvir-timestamp=2017-02-20T00:00:00&dvir-type=pre-trip&user-id=1254763
RESPONSE: Downloads the uploaded DVIR Report PDF. 
ERROR RESPONSE:

When the parameters are incorrect or there is no uploaded DVIR Report PDF for that day and User. This error message is returned.

<Error>
  <ErrorCode>7000</ErrorCode>
  <Message><![CDATA[File not found - Request URL: https://staging.vistracks.com/api/v2/dvirReports?dvir-timestamp=2017-02-20T00:00:00&dvir-type=pre-trip&user-id=1254763]]></Message>
  <Details><ObjectType></ObjectType></Details
</Error>

Note: Use the HEAD method with the same parameters as the GET method to check if a DVIR Report has been uploaded.

Create

API PATH: /api/v2/dvirReports
METHOD: POST
PARAMETERS dvir-timestamp – [REQUIRED] Uploads the DVIR Report and sets its timestamp based on the timestamp specified.
dvir-type – [REQUIRED] Uploads the DVIR Report and sets its DVIR type based on the DVIR type specified.
EXAMPLE REQUEST:

To upload a DVIR Report. The request must be a multipart and must have a PDF file. 

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="file"; filename="DVIRReport.pdf"
 Content-Type: application/pdf

 <@INCLUDE *C:\Users\User\Desktop\DVIRReport.pdf*@>
 ---------------------------acebdf13572468--