calc_last

To get the last known sensor values and key indicators for units, use the unit/calc_last method.

Endpoint

Copied!
svc=unit/calc_last&params={
    "itemIds": [<long>]
}

Parameters

The request must contain the parameter itemIds specifying the array of unit IDs for which you want to retrieve the last known sensor values and indicators.

Example

Below is an example of the unit/calc_last request.

Copied!
svc=unit/calc_last&params={
    "itemIds": [16091323, 16454260]
}

Response

If the request is completed successfully, the response is returned in the following format:

Copied!
[
    {
        "i": <long>,         // Unit ID.
        "mileage": {         // Mileage counter.
            "value": <double>,
            "format": {
                "value": <text>  // Formatted value with units of measurement (e.g., "24498.82 km").
            }
        },
        "engine_hours": {    // Engine hours counter.
            "value": <double>,
            "format": {
                "value": <text>  // Formatted value with units of measurement (e.g., "0.00 h").
            }
        },
        "pos": {             // Last known position.
            "y": <double>,   // Latitude.
            "x": <double>,   // Longitude.
            "c": <int>,      // Course.
            "z": {           // Altitude.
                "value": <double>,
                "format": {
                    "value": <text>  // Formatted value with units of measurement (e.g., "139.00 m").
                }
            },
            "s": {           // Speed.
                "value": <double>,
                "format": {
                    "value": <text>  // Formatted value with units of measurement (e.g., "75.00 km/h").
                }
            },
            "sc": <int>      // Number of satellites.
        },
        "sensors": {         // Sensor values.
            "<sensor_id>": {
                "value": <double|text>,    // Raw sensor value.
                "format": {
                    "value": <text>        // Formatted sensor value with units of measurement.
                }
            }
        }
    }
]

If the request fails, an error code is returned.

Error codes

Error code Description
4 Invalid input parameters.
7 No View object and its basic properties access right to units.

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

Report a mistake

Your message was sent. Thank you!

An error occurred while submitting the form