Skip to content

Sensor information

Add sensor

Description:

Used to add a new sensor interface

Request

Request method:

POST

Headers:

Content-type: application/json

URL

https://spoilerinterface.com/interface/add/sensor

Request body:

Note: After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.

The request body should be sent as form-data and it should contain the device information as illustrated in the section below:

Field name Description Type
sensor_name Name of the sensor str
sensor_type The type of sensor str
sensor_token [Optional] Token that will be used to update the sensor. If not specified, a random token will be generated str
sensor_value [Optional] Initial value for the the sensor. int
sensor_details Sensor details which will be stored as a json object json
update_period How often the sensor will be updated. This time is used to calculate the sensor status. If no updates are received withing this period, the device status will be regarded as offline. An email will be sent to the user if notifications are enabled when the status changes. str

JSON format

{
    "sensor_name":"Test sensor",
    "sensor_type":"Humidity",
    "sensor_token":"f5d6dsewwds",
    "sensor_value": 10,
    "sensor_details":"{}",
    "update_period":120
}

Request example:

None

Response

{
    "success": {
        "sensor_id": 301683363710870,
        "sensor_token": "df45g56df6"
    }
}

Field description

The response information contains a success key which indicates that the sensor interface has been added successfully

Sensors count

Description:

Used to get number of sensors available

Request

Request method:

GET

Headers:

Content-type: application/json

URL

https://spoilerinterface.com/interface/sensor/count

Request body:

None

Note:

After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.

Request example:

None

Response

{
    "success": {
        "sensors": 1
    }
}

Field description

The response information contains a success key which indicates that the sensor interface has been added successfully

List sensors

Description:

Used to list all the sensors for the user

Request

Request method:

GET

Headers:

Content-type: application/json

URL

https://spoilerinterface.com/interface/sensor/list

Request body:

Note: After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.

None

Request example:

None

Response

{
    "success": [
        {
            "sensor_id": 211674590684890,
            "sensor_name": "Door sensor",
            "sensor_type": "Temperature",
            "update_time": 1674590684,
            "sensor_status": "Offline",
            "sensor_value": 0.0,
            "sensor_token": "68eff1a9010cd7ffac801511f55fcb71a100ca4e",
            "update_period": 900,
            "last_modified": 1674590684,
            "notification_enabled": true,
            "alarms": [
                {
                    "alarm_id": 1675276699283,
                    "device_id": 211674590684890,
                    "alarm_name": "Test",
                    "alarm_enabled": true,
                    "alarm_threshold_value": 30.0,
                    "alarm_condition": ">",
                    "alarm_trigger_time": null,
                    "alarm_repeat_delay": 300,
                    "alarm_akn": null,
                    "update_time": 1675276699,
                    "alarm_triggered": false
                }
            ],
            "whatsapp_enabled": null,
            "value_units": "",
            "sms_enabled": null
        }
    ]
}

Field description

The response information contains a success key which indicates that the sensor interface has been added successfully

Field name Description Type
sensor_name Name of the sensor str
sensor_type The type of sensor str
sensor_token [Optional] Token that will be used to update the sensor. If not specified, a random token will be generated str
sensor_value [Optional] Initial value for the the sensor. int
sensor_details Sensor details which will be stored as a json object json
value_units Sensor units str
last_modified Indicates the latest update time in epoch json
notification_enabled Indicates if the notifications have been enabled for the interface json
whatsapp_enabled Indicates if whatsapp notifications have been enabled for the interface json
sms_enabled Indicates if sms notifications have been enabled for the interface json
update_period How often the sensor will be updated. This time is used to calculate the sensor status. If no updates are received withing this period, the device status will be regarded as offline. An email will be sent to the user if notifications are enabled when the status changes. str

Sensors Status

Description:

Used to get sensor status

Request

Request method:

GET

Headers:

Content-type: application/json

URL

https://spoilerinterface.com/interface/sensor/status

Request body:

The request info should be sent as params or json body and it should contain the device information as illustrated in the section below.

Note:

After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.

Request example:

Params example

https://spoilerinterface.com/interface/sensor/status?sensor_id=65698658484984584&sensor_token=fds654gf654gdf56gdf654gdf

Json body example

{
    "sensor_id": 65698658484984584,
    "sensor_token": "fds654gf654gdf56gdf654gdf"
}

Response

{
    "success": [
        {
            "sensor_id": 211674590684890,
            "sensor_name": "Door sensor",
            "sensor_type": "Temperature",
            "update_time": 1674590684,
            "sensor_status": "Offline",
            "sensor_value": 0.0,
            "sensor_token": "68eff1a9010cd7ffac801511f55fcb71a100ca4e",
            "update_period": 900,
            "last_modified": 1674590684,
            "notification_enabled": true,
            "alarms": [
                {
                    "alarm_id": 1675276699283,
                    "device_id": 211674590684890,
                    "alarm_name": "Test",
                    "alarm_enabled": true,
                    "alarm_threshold_value": 30.0,
                    "alarm_condition": ">",
                    "alarm_trigger_time": null,
                    "alarm_repeat_delay": 300,
                    "alarm_akn": null,
                    "update_time": 1675276699,
                    "alarm_triggered": false
                }
            ],
            "value_units": "",
            "whatsapp_enabled": null,
            "sms_enabled": null,
        }
    ]
}

Field description

The response information contains a success key which indicates that the sensor interface has been added successfully

Field name Description Type
sensor_name Name of the sensor str
sensor_type The type of sensor str
sensor_token [Optional] Token that will be used to update the sensor. If not specified, a random token will be generated str
sensor_value [Optional] Initial value for the the sensor. int
sensor_details Sensor details which will be stored as a json object json
value_units Sensor units str
last_modified Indicates the latest update time in epoch json
notification_enabled Indicates if the notifications have been enabled for the interface json
whatsapp_enabled Indicates if whatsapp notifications have been enabled for the interface json
sms_enabled Indicates if sms notifications have been enabled for the interface json
update_period How often the sensor will be updated. This time is used to calculate the sensor status. If no updates are received withing this period, the device status will be regarded as offline. An email will be sent to the user if notifications are enabled when the status changes. str

Sensors update

Description:

Used to update sensor status

Request

Request method:

POST

Headers:

Content-type: application/json

URL

https://spoilerinterface.com/interface/update/sensor

Request body:

The request info should be sent as params or json body and it should contain the device information as illustrated in the section below.

Note:

After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.

Request example:

Params example

https://spoilerinterface.com/interface/update/sensor?sensor_value=100&sensor_token=df45ddddsdaewg56df6&sensor_id=301659085216623

Json body example

{
    "sensor_id":301659085216623,
    "sensor_token": "df45ddddsdaewg56df6",
    "sensor_value": "11"
}

Response

{
    "success": "success"
}

Field description

The response information contains a success key which indicates that the sensor interface has been added successfully

Sensors history

Description:

Used to get sensor history data

Request

Request method:

GET

Headers:

Content-type: application/json

URL

https://spoilerinterface.com/interface/sensor/history

Request body:

The request info should be sent as params or json body and it should contain the device information as illustrated in the section below.

Field name Description Type
min_epoch_tm_sec Minimum time for history record str
max_epoch_tm_sec [Optional] Maximum time for history data. This is set to current epoch time if not specified str
sensor_id [Optional] Sensor ID. All sensor history will be returned if not specified str

Note:

After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.

Request example:

Params example

https://spoilerinterface.com/interface/sensor/history?min_epoch_tm_sec=1641502593

Json body example

{
    "min_epoch_tm_sec": 1641502593,
    "max_epoch_tm_sec": 1999999999,
    "sensor_id": 65897465466
}

Response

{
    "success": [
        {
            "sensor_id": 301683363710870,
            "sensor_name": "rose",
            "sensor_type": "Sensor",
            "min_time": 1683365207,
            "max_time": 1683365207,
            "data": [
                {
                    "sensor_value": 11.0,
                    "update_time": "2023-05-06T11:26:47"
                }
            ]
        }
    ]
}

Field description

The response information contains a success key which indicates that the sensor interface has been added successfully

Field name Description Type
sensor_id Sensor ID str
sensor_name Name of the sensor str
sensor_type The type of sensor str
min_time Minimum history time available str
max_time Maximum history time int
data Array containing sensor data. json

Sensors edit

Description:

Used to edit sensor information

Request

Request method:

POST

Headers:

Content-type: application/json

URL

https://spoilerinterface.com/interface/edit/sensor

Request body:

The request info should be sent as params or json body and it should contain the device information as illustrated in the section below.

Field name Description Type
sensor_name Name of the sensor str
sensor_type The type of sensor str
sensor_token [Optional] Token that will be used to update the sensor. If not specified, a random token will be generated str
value_units Sensor units str
update_period How often the sensor will be updated. This time is used to calculate the sensor status. If no updates are received withing this period, the device status will be regarded as offline. An email will be sent to the user if notifications are enabled when the status changes. str

Note:

Only the sensor owner can edit the interface information.

After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.

Request example:

Params example

https://spoilerinterface.com/interface/edit/sensor?sensor_id=545467565849421245489&sensor_token=5fgd94dgfd6fsd8d986gd6dg&sensor_name=Sensor&update_period=300

Json body example

{
    "sensor_id": "545467565849421245489",
    "sensor_token": "5fgd94dgfd6fsd8d986gd6dg",
    "sensor_name": "Sensor",
    "update_period": 300
}

Response

{
    "success": "success"
}

Field description

The response information contains a success key which indicates that the sensor interface has been added successfully

Delete sensor

Description:

Used to delete sensor

Request

Request method:

POST

Headers:

Content-type: application/json

URL

https://spoilerinterface.com/interface/delete/sensor

Request body:

The request info should be sent as params or json body and it should contain the device information as illustrated in the section below.

Note:

After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.

Request example:

Params example

https://spoilerinterface.com/interface/delete/sensor?sensor_value=100&sensor_token=df45ddddsdaewg56df6&sensor_id=301659085216623

Json body example

{
    "sensor_id":301659085216623,
    "sensor_token": "df45ddddsdaewg56df6",
}

Response

{
    "success": "success"
}

Field description

The response information contains a success key which indicates that the sensor interface has been added successfully

Enable alerts

Description:

Used to enable interface alerts

Request

Request method:

POST

Headers:

Content-type: application/json

URL

https://spoilerinterface.com/interface/sensor/enable/alerts

Request body:

None

Note:

After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.

Enable alerts

Description:

Used to disable interface alerts

Request

Request method:

POST

Headers:

Content-type: application/json

URL

https://spoilerinterface.com/interface/sensor/disable/alerts

Request body:

None

Note:

After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.

Request example:

None

Response

{
    "success": "success"
}

Field description

The response information contains a success key which indicates that the sensor interface has been added successfully

Enable whatsapp

Description:

Used to enable interface whatsapp alerts

Request

Request method:

POST

Headers:

Content-type: application/json

URL

https://spoilerinterface.com/interface/sensor/enable/whatsapp

Request body:

None

Note:

After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.

Response

{
    "success": "success"
}

Field description

The response information contains a success key which indicates that the sensor interface has been added successfully

Disable whatsapp alerts

Description:

Used to disable interface whatsapp alerts

Request

Request method:

POST

Headers:

Content-type: application/json

URL

https://spoilerinterface.com/interface/sensor/disable/whatsapp

Request body:

None

Note:

After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.

Request example:

None

Response

{
    "success": "success"
}

Field description

The response information contains a success key which indicates that the sensor interface has been added successfully

Enable sms alerts

Description:

Used to enable interface sms alerts

Request

Request method:

POST

Headers:

Content-type: application/json

URL

https://spoilerinterface.com/interface/sensor/enable/sms

Request body:

None

Response

{
    "success": "success"
}

Field description

The response information contains a success key which indicates that the sensor interface has been added successfully

Note:

After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.

Disable sms alerts

Description:

Used to disable interface sms alerts

Request

Request method:

POST

Headers:

Content-type: application/json

URL

https://spoilerinterface.com/interface/sensor/disable/sms

Request body:

None

Note:

After authenticating, a cookie will be set on the response and this can be used to make further request without including the api_key in the request params.

Request example:

None

Response

{
    "success": "success"
}

Field description

The response information contains a success key which indicates that the sensor interface has been added successfully