Skip to main content

Using the data import API

Programmatically import and update variable data using the ioTORQ EMIS REST API

Updated over 3 weeks ago

In addition to manual uploads, ioTORQ EMIS allows data to be imported programmatically using the API. API data import is useful when you need to:

  • Automate data ingestion from external systems

  • Backfill large volumes of historical data

  • Update variables on a scheduled basis

  • Integrate ioTORQ EMIS with third-party platforms

  • Import data when a live connector is not available

API imports create or update data points in existing variables (auto-variables) within ioTORQ EMIS.


Before you begin

To use the API Data Import feature, you must have:

  • An active ioTORQ EMIS user account

  • An API token associated with that user

  • Existing variables in ioTORQ EMIS to receive the data

Each API token is linked to a specific user account, and all imported data is attributed to that user.


API endpoint

Data is imported using an HTTPS POST request to:

/ems/api/import/

All API URLs are relative to your company’s ioTORQ EMIS domain.
For example, if your account URL is:

https://mycompany.iotorq.com

The full API endpoint is:

https://mycompany.iotorq.com/ems/api/import/

Authentication and headers

Every request must include the following HTTP headers:

  • Authorization: Token <your_api_token>

  • Content-Type: application/json

Requests without valid authentication will be rejected.


Request format

Data must be sent as JSON.
The request body is a list of objects, where each object represents a variable (meter) and its time-series data.

Each object includes:

Variable identification

You can identify a variable using one of the following methods:

  • Meter Code (recommended for most users)

  • Variable ID (primary key)

Field

Description

id_type

How the variable is identified (meter_code or pk)

id_value

The meter code or variable ID that exists in ioTORQ EMIS


Timeseries data

Each variable includes a series object containing timestamps and values.

Field

Description

datetime

A list of UNIX timestamps

val

A list of numeric values (must match the datetime list)

time_unit

Optional. Use "ms" if timestamps are in milliseconds

  • Timestamps are assumed to be seconds since Jan 1, 1970 (UTC) unless otherwise specified.

  • The number of timestamps must match the number of values.


Example: Import data using meter codes

[
{
"id_type": "meter_code",
"id_value": "my_meter_code1",
"series": {
"datetime": [1494880000, 1494880060, 1494880120],
"val": [1, 2, 3]
}
},
{
"id_type": "meter_code",
"id_value": "my_meter_code2",
"series": {
"datetime": [1494880000, 1494880060, 1494880120],
"val": [2.0, 5.5, 4.1]
}
}
]

This example imports data for two variables, each with multiple timestamps and values.


Handling duplicate timestamps

If data is submitted for a timestamp that already exists:

  • The new value overwrites the existing value

  • If multiple values for the same timestamp are included in a single request, only one value will be stored, and the result is not guaranteed

To avoid unintended overwrites, ensure timestamps are unique per variable.


Using millisecond timestamps

If your timestamps are in milliseconds, include the time_unit field:

"time_unit": "ms"

Without this field, timestamps are treated as seconds.


Request limits

  • There is no limit to the number of variables per request

  • The total request size must be under 2 MB

For very large imports, split the data into multiple requests.


Response and validation

If the request is accepted, the API returns:

  • HTTP 202 – Accepted

This confirms the data was received successfully.

Imported data will appear in the variable’s chart view shortly after submission.

Did this answer your question?