To upload tacho file to the server and get it parsed please use that resource/upload_tacho_file signature:
svc=resource/upload_tacho_file¶ms={"outputFlag":<uint>, "eventHash":<text>}
To bind uploaded file content to specified driver use that signature:
svc=resource/upload_tacho_file¶ms={"itemId":<long>, "driverCode":<text>, "guid":<text>, "outputFlag":<uint>}
Parameters
Param | Description |
---|---|
itemId | resource/account id |
driverCode | driver code |
guid | uploaded file identifier |
outputFlag | response flag: 1 – get ddd header; 2 – get activity |
eventHash | event name which will be gene- rated after processing the data |
To bind file content to the driver do the following:
-
upload file to the server using 1st method signature with POST-request and then get response
guid
param;
Request URL:https://hst-api.example.com/example/ajax.html?svc=resource/upload_tacho_file&sid=<sid> Request Method:POST Content-Type:multipart/form-data; boundary=----WebKitFormBoundary5QlpCrB8XAgXVIdR ------WebKitFormBoundary5QlpCrB8XAgXVIdR Content-Disposition: form-data; name="params" {"outputFlag":2,"eventHash":"jUploadForm1434694609224"} ------WebKitFormBoundary5QlpCrB8XAgXVIdR Content-Disposition: form-data; name="eventHash" jUploadForm1434694609224 ------WebKitFormBoundary5QlpCrB8XAgXVIdR Content-Disposition: form-data; name="upload_ddd"; filename="tacho_file.ddd" Content-Type: application/octet-stream ------WebKitFormBoundary5QlpCrB8XAgXVIdR--
-
use received
guid
in the 2nd method signature to bind file content to the driver.
Response
{ "guid":<text>, /* uploaded file identifier */ "parseResult": { /* parse result */ "an":<text>, /* issue authority */ "c":<text>, /* country */ "dc":<text>, /* driver code, 14 symbols */ "dn":<text>, /* driver name */ "la":<long>, /* issue date */ "ed":<long>, /* expiry date */ "fa":<long>, /* first activity date */ "id":<long>, /* last activity date */ "vb":<long>, /* validity begin */ "vl": [<text>] /* vehicle reg numbers */ "activity": { /* driver activity; shown if outputFlag:2 stated */ "Availability": { "a":<uint>, /* driver action, it is used to sort into Availability, Break/Rest etc: 0 - break/rest, 1 - availability, 2 - work, 3 - driving */ "cs":<uint>, /* card status: 0 - inserted; 1 - not inserted */ "s":<uint>, /* driver slot: 0 - driver, 1 - co-driver */ "st":<uint>, /* driver status: 0 - single, 1 - crew */ "t":<uint> /* time */ }, "Break/Rest": { "a":<uint>, "cs":<uint>, "s":<uint>, "st":<uint>, "t":<uint> }, "Driving": { "a":<uint>, "cs":<uint>, "s":<uint>, "st":<uint>, "t":<uint> }, "Work": { "a":<uint>, "cs":<uint>, "s":<uint>, "st":<uint>, "t":<uint> } } } }