upload_tacho_file

The resource/upload_tacho_file method is used for uploading tachograph files to the server.

To upload a tachograph file and get it parsed, use signature 1:

Copied!
svc=resource/upload_tacho_file&params={
    "outputFlag": <uint>,
    "eventHash": "<text>"
}

Send this request as a POST request with multiple parts (multipart/form-data): one part contains the parameters, and the other contains the DDD file.

To bind the content of the uploaded file to a specified driver, use signature 2:

Copied!
svc=resource/upload_tacho_file&params={
    "itemId": <long>,
    "driverCode": "<text>",
    "guid": "<text>",
    "outputFlag": <uint>
}

Parameters

Below is the description of the request parameters.

Parameter Description
itemId Resource ID.
driverCode Driver code.
guid Uploaded file identifier. You can get it from the event that is generated after a request with signature 1 (see Response).
outputFlag Response flag: 1 to get the DDD header, 2 to get the header and activity. Required in both signatures.
eventHash Name of the event that is generated after the file is processed.

Response

If a request with signature 1 is completed successfully, an empty object is returned:

Copied!
{}

The parsing result is delivered as an event. To get it, use the avl_evts method:

Copied!
{
    "tm": <uint>,
    "events": [
        {
            "i": -1,
            "d": {
                "hash": "<text>",                   // Value of the eventHash parameter.
                "result": {
                    "svc_error": 0,
                    "svc_result": {
                        "guid": "<text>",           // Uploaded file identifier.
                        "parseResult": {...}        // Parsing result (see below).
                    }
                }
            }
        }
    ]
}

If the file can’t be uploaded, the request returns error 5, and the event contains "result": {"svc_error": 5}.

If the file can’t be parsed, the request returns error 4. In this case, the event either contains "result": {"svc_error": 4} or isn’t generated at all, so check the response to the request as well.

If a request with signature 2 is completed successfully, the response contains the parsing result without the guid key.

The parsing result has the following format:

Copied!
{
    "an": <text>,                       // Issue authority.
    "c": <text>,                        // Country.
    "dc": <text>,                       // Driver's code, 16 characters: the 14-character card number followed by the card replacement and renewal indexes.
    "dn": <text>,                       // Driver's name. 
    "la": <long>,                       // Last activity date.
    "ed": <long>,                       // Expiry date.
    "fa": <long>,                       // First activity date. 
    "id": <long>,                       // ID. 
    "vb": <long>,                       // Validity period beginning. 
    "vl": [<text>],                     // Vehicle registration plate. 
    "activity": {                       // Driver's activity. Shown if outputFlag:2 is set. 
        "Availability": {
            "a": <uint>,                // Driver's action: 0: break/rest, 1: availability, 2: work, 3: driving. 
            "cs": <uint>,               // Card status: 0: inserted, 1: not inserted. 
            "s": <uint>,                // Driver's slot: 0: driver, 1: co-driver. 
            "st": <uint>,               // Number of drivers: 0: one driver, 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>
        }
    }
}

If the request fails, an error code is returned.

Error codes

Error Code Description
4 One of the following errors:
  • Invalid input parameters.
  • Driver not found (for signature 2).
  • Failed to parse the uploaded file (for signature 1) or the file with the guid (for signature 2).
5 One of the following errors:
  • Failed to upload the DDD file (for signature 1).
  • Failed to write the DDD file (for signature 2).
  • Failed to read a file with the guid from the file system (for signature 2).
7 One of the following errors (for signature 2):
  • No Create, edit, and delete drivers access right to the resource.
  • Failed to find the resource with the specified ID.

If you find a mistake in the text, please select it and press Ctrl+Enter.