The chat responses are generated using Generative AI technology for intuitive search and may not be entirely accurate. They are not intended as professional advice. For full details, including our use rights, privacy practices and potential export control restrictions, please refer to our Generative AI Service Terms of Use and Generative AI Service Privacy Information. As this is a test version, please let us know if something irritating comes up. Like you get recommended a chocolate fudge ice cream instead of an energy managing application. If that occurs, please use the feedback button in our contact form!
Skip to content

Timeseries

Time series data can be provided by sending data to HTTP APIs, either GraphQL, CSV REST, or JSON REST. When sending data either a Mapping ID or a Senseye sensor ID (in the form of a UUID) can be used to address a sensor. If a Mapping ID is used, and a sensor does not already exist with this mapping ID, a new sensor is automatically provisioned.

Info

For user tokens, the associated user needs to be a system administrator to send data.

Machine tokens require permissions to write data and create sensors. If using Mapping IDs with a machine token, your token will also require permissions to read and write mapping IDs.

GraphQL

We support sending data via GraphQL using the storeSensorMeasureData mutation.

Query
mutation storeSensorMeasureData($input: StoreSensorMeasureDataInput!) {
    storeSensorMeasureData(input: $input) {
        clientMutationId
    }
}
Variables
{
    "input": {
        "mappingId": "mappingId",
        "dataPoints": [{
            "measureName": "temperature",
            "floatValue": 66,
            "timestamp": "2022-04-29T12:55:14+01:00"
        }, {
            "measureName": "current",
            "floatValue": 525,
            "timestamp": "2022-04-29T12:55:14+01:00"
        }, {
            "measureName": "recipe",
            "stringValue": "87N",
            "timestamp": "2022-04-29T12:50:00+01:00"
        }, {
            "measureName": "run",
            "booleanValue": true,
            "timestamp": "2022-04-29T12:50:00+01:00"
        }],
        "clientMutationId": "Your Identifier"
    }
}
Response
{
    "data": {
        "clientMutationId": "Your Identifier"
    }
}

Query
mutation storeSensorMeasureData($input: StoreSensorMeasureDataInput!) {
    storeSensorMeasureData(input: $input) {
        clientMutationId
    }
}
Variables
{
    "input": {
        "sensorId": "sensorId",
        "dataPoints": [{
            "measureName": "temperature",
            "floatValue": 66,
            "timestamp": "2022-04-29T12:55:14+01:00"
        }, {
            "measureName": "current",
            "floatValue": 525,
            "timestamp": "2022-04-29T12:55:14+01:00"
        }, {
            "measureName": "recipe",
            "stringValue": "87N",
            "timestamp": "2022-04-29T12:50:00+01:00"
        }],
        "clientMutationId": "Your Identifier"
    }
}
Response
{
    "data": {
        "clientMutationId": "Your Identifier"
    }
}

The clientMutationId response in the above example can be ignored. Up to 15000 datapoints can be stored in a single storeSensorMeasureData mutation.

CSV REST

The CSV formatted data should conform to the structure detailed here. It should be sent within the body of a POST request as shown below:

POST /v1/hub/mappings/{mappingId}/data HTTP/1.1
Host: api.senseye.io
Authorization: Bearer your_access_token
Content-Type: text/csv

DATETIME,temperature,current,product,run
2022-04-29T11:13:14+01:00,60,456,"A24",true
2022-04-29T12:01:45+01:00,61,500,"A24",false
POST /v1/hub/sensors/{senseyeId}/data HTTP/1.1
Host: api.senseye.io
Authorization: Bearer your_access_token
Content-Type: text/csv

DATETIME,temperature,current,product,run
2022-04-29T11:13:14+01:00,60,456,"A24",true
2022-04-29T12:01:45+01:00,61,500,"A24",false

JSON REST

We use SenML to transfer sensor data via REST; this is a popular JSON format. As an example:

SenML
{
    "e": [
        {
            "n": "temperature",
            "v": 65,
            "t": 1651236101
        },
        {
            "n": "current",
            "v": 520,
            "t": 1651236101
        },
        {
            "n": "product",
            "sv": "A24",
            "t": 1651236101
        },
        {
            "n": "run",
            "bv": true,
            "t": 1651236101
        }
    ]
}

Where n is the measure name, t is the unix time (see here for more info), v is a numeric value, sv is a string value and bv is a boolean value.

A SenML representation of your data should be posted as follows:

POST /v1/hub/mappings/{mappingId}/data HTTP/1.1
Host: api.senseye.io
Authorization: Bearer your_access_token
Content-Type: application/json

{
    "e": [{
        "n": "temperature",
        "v": 65,
        "t": 1651236101
    }, {
        "n": "current",
        "v": 520,
        "t": 1651236101
    }, {
        "n": "product",
        "sv": "A24",
        "t": 1651236101
    }, {
        "n": "run",
        "bv": true,
        "t": 1651236101
    }]
}
POST /v1/hub/sensors/{sensorId}/data HTTP/1.1
Host: api.senseye.io
Authorization: Bearer your_access_token
Content-Type: application/json

{
    "e": [{
        "n": "temperature",
        "v": 65,
        "t": 1651236101
    }, {
        "n": "current",
        "v": 520,
        "t": 1651236101
    }, {
        "n": "product",
        "sv": "A24",
        "t": 1651236101
    }, {
        "n": "run",
        "bv": true,
        "t": 1651236101
    }]
}