Blog

Access raw telematics data via API

Vehicle IoT data is increasingly seen as a goldmine for businesses, offering benefits from enhanced awareness and process automation to improved decision-making. However, the practical challenges of retrieving and consolidating this data from GPS devices, vehicle sensors, and CAN buses into a manageable format, especially when requiring both real-time and historical insights, are significant. Navixy's API provides a solution to these issues, offering easy access to this crucial data, thereby streamlining operations and facilitating smarter decision-making for telematics solution developers.

Navixy Raw IoT Data API

The Navixy Raw IoT Data API is designed for developers who need to efficiently manage and analyze vehicle IoT data. It facilitates access to parsed raw data from GPS devices, sensors, and CAN buses, solving the challenge of aggregating and interpreting vast amounts of telematics information. By providing straightforward API calls, developers can retrieve historical and real-time data, essential for building applications that require detailed vehicle insights for automation, process optimization, and informed decision-making.

Designed with performance in mind, Navixy Raw IoT Data collects and stores comprehensive data from GPS devices and dash cams. It aggregates the full range of data, from sensor connections to CAN bus readings, in its raw form, providing long-term storage and quick access to the data in a unified format. This makes it the right choice for developers looking to build scalable telematics applications.

Getting started with Raw IoT Data API

The Raw IoT Data API offers two key methods for accessing telematics data: get_inputs and read. The get_inputs method is used to identify the available data fields from a device, such as metering inputs and state fields, essential for understanding what data can be retrieved. The read method allows for the actual retrieval of this data for a specified time period, in parsed raw format.

As an example, let's take an OBDII tracker and retrieve data including GPS locations, I/O states, and CAN bus information. The following Python code demonstrates how to access this data through API:

import requests

# Replace with your actual API server URL and API key
API_URL = "https://api.navixy.com/v2/data-warehouse/tracker"
API_KEY = "your_api_key_here"

# Tracker ID for the OBDII device
TRACKER_ID = 12345

def get_inputs(tracker_id):
    """
    Get available data fields for the tracker.
    """
    payload = {
        "hash": API_KEY,
        "tracker_id": tracker_id,
    }
    response = requests.post(f"{API_URL}/get_inputs", json=payload)
    if response.status_code == 200:
        return response.json()
    else:
        return None

def read_data(tracker_id, from_date, to_date):
    """
    Retrieve parsed raw data from the tracker within the specified time range.
    Data includes GPS location, I/O signals, and CAN bus data.
    """
    payload = {
        "hash": API_KEY,
        "tracker_id": tracker_id,
        "from": from_date,
        "to": to_date,
        "format": "json"  # Can be changed to "csv" if preferred
    }
    response = requests.post(f"{API_URL}/read", json=payload)
    if response.status_code == 200:
        return response.json()
    else:
        return None

# Example usage
if __name__ == "__main__":
    # Date range
    from_date = "2024-01-01T00:00:00Z"
    to_date = "2024-01-02T00:00:00Z"

    inputs = get_inputs(TRACKER_ID)
    print("Available data fields:", inputs)

    data = read_data(TRACKER_ID, from_date, to_date)
    print("Retrieved data:", data)

For an OBDII tracker, the output of get_inputs returns JSON with data indicating the tracker's capabilities, such as a variety of inputs like battery voltage, board voltage, and external Bluetooth sensors:

{
    "discrete_inputs": 2,
    "discrete_outputs": 1,
    "inputs": [
        "analog_1",
        "battery_voltage",
        "board_voltage",
        "ext_temp_sensor_4",
        "freq_1",
        "hw_mileage",
        "impulse_counter_1",
        "lls_level_4",
        "lls_temperature_4"
    ],
    "states": [
        "hardware_key"
    ],
    "success": true
}

The read method's output, in CSV format, includes detailed records for specific columns like latitude, longitude, speed, and specific OBDII data fields like fuel level or engine RPMs. Each row in the CSV would represent a data point, providing time-stamped, decoded values from the tracker for the requested period:

{
 "csv": "\"msg_time\",\"lat\",\"lng\",\"speed\",\"inputs.ble_lls_level_1\",\"inputs.hw_mileage\",\"discrete_inputs.1\",\"discrete_inputs.2\"\n\"2023-11-30T13:13:14+0600\",54.22809,69.5264283,28,2871,24296.444,0,1\n\"2023-11-30T13:13:25+0600\",54.228095,69.5278333,32,2871,24296.536,0,1"
}

Remember to handle the API responses appropriately in your real application, checking for errors and parsing the data according to your needs.

At Navixy, we see ourselves as your reliable partner in telematics development, offering robust support through our APIs. Our goal is to streamline your work with vehicle data, enhancing efficiency and ease of use (btw, you can easily download telematics data to a CSV file). Should you require further assistance or have any inquiries regarding your projects, our technical support and solution consultant teams are at your disposal. Partnering with Navixy connects you with a dedicated community focused on turning your telematics visions into reality.

← Previous articleNext article →
Ready for the most innovative GPS tracking software?
SIGN UP
Recent posts