Sensor
Creating an internal hub sensor can be done via either our GraphQL or JSON REST APIs. Sensors can either ingest time series data or frequency spectrum data; they cannot do both, and this must be set when a sensor is being created.
During sensor creation a mappingId
can be provided, which allows you to interact with the sensor using your own ID, rather than Senseye's ID. If you plan to use a mappingID
to send data we recommend skipping the sensor creation step as sending data to a new mappingId
will automatically create a new sensor for you. For more information, see the Push to Senseye page.
You may also optionally provide a description for the sensor.
GraphQL¶
We support sensor creation via GraphQL using the createSensor mutation.
mutation createSensor($input: CreateSensorInput!) {
createSensor(input: $input) {
sensor {
id
name
mappingId
}
}
}
{
"input": {
"hubType": "IHUB",
"name": "Sensor's name",
"description": "A description of the sensor",
"mappingId": "Your ID for the sensor"
}
}
{
"data": {
"createSensor": {
"sensor": {
"id": "Senseye's ID for the sensor",
"name": "Sensor's name",
"mappingId": "Your ID for the sensor",
"ingestType": "timeseries" | "frequency"
}
}
}
}
JSON REST¶
Alternatively, sensors can be created via our REST endpoint. This can be done by sending a POST request with a JSON body containing the sensor's details, as shown below:
POST /v1/hub/sensors HTTP/1.1
Host: api.senseye.io
Authorization: Bearer your_access_token
Content-Type: application/json
{
"name": "Sensor's name",
"description": "A description of the sensor", // optional
"mappingId": "Your ID for the sensor", // optional
"ingest": "timeseries" | "frequency"
}
curl --location --request POST 'https://api.senseye.io/v1/hub/sensors' \
--header 'Authorization: Bearer your_access_token' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Sensor name",
"description": "A description of the sensor",
"mappingId": "Your ID for the sensor",
"ingest": "timeseries" | "frequency"
}'