Sensors & Metatags

Get the metatags of serveral sensors attached to a group: GET /groups/{group_id}/sensors/metatags

This method will return a list of sensors with their metatags.

URLhttps://api.sense-os.nl/groups/{group_id}/sensors/metatags
MethodGET
Need AuthTrue

Request Headers

NameDefaultTypeStyleRequired
Accept*xsd:stringheaderTrue

Request Parameters

NameDescriptionType
detailsTo get all the related data as name, display_name, type, device_type, data_typ_id, pager_type, data_type and data_structure the parameter details=full can be used. If only a list of sensor id's is needed then details=no can be used. xsd:string
namespaceFind metatags attached to given namespace. If not given “default” is assumed as the namespace. xsd:string
sensor_owner“me” only return metatags of sensors owned by the current user. “shared” only return sensors shared with me. “all” return all sensors owned by me or shared with me. When not given “me” is assumed xsd:string

Request Body

{
    "sensors": [
        {
            "id": "1",
            "name": "pwrmtr123",
            "display_name": "Power meter",
            "type": "1",
            "device_type": "BMA123",
            "data_type_id": "1",
            "pager_type": "email",
            "data_type": "json",
            "data_structure": "{\"x-axis\":\"float\",\"y-axis\":\"float\",\"z-axis\":\"float\"}",
            "metatags": {
                "measurement_type": [
                    "electricty_produced"
                ],
                "measurement_unit": [
                    "kWh"
                ],
                "measurement_interval": [
                    "15min",
                    "30min"
                ],
                "project": [
                    1
                ],
                "manufacturer": [
                    "philips"
                ],
                "manufacturer_modelnr": [
                    "3254"
                ],
                "manufacturer_model_name": [
                    "Powermeter"
                ],
                "heating_unit": [
                    "1"
                ]
            }
        },
        {
            "id": "2",
            "name": "pwrmtr123",
            "display_name": "Power meter",
            "type": "1",
            "device_type": "BMA123",
            "data_type_id": "1",
            "pager_type": "email",
            "data_type": "json",
            "data_structure": "{\"x-axis\":\"float\",\"y-axis\":\"float\",\"z-axis\":\"float\"}",
            "metatags": {
                "measurement_type": [
                    "electricty_produced"
                ],
                "measurement_unit": [
                    "kWh"
                ],
                "measurement_interval": [
                    "15min",
                    "30min"
                ],
                "project": [
                    1
                ],
                "manufacturer": [
                    "philips"
                ],
                "manufacturer_modelnr": [
                    "3254"
                ],
                "manufacturer_model_name": [
                    "Powermeter"
                ],
                "heating_unit": [
                    2
                ]
            }
        }
    ]
}

Finding sensors by metatags within a group: POST /groups/{group_id}/sensors/find

Via this method a list of sensors can be selected based on a set of conditions. Supported operators are “equal”, “in”, and “is_set”. All string comparisons are case INsensitive. Currently supported are two types of statement groups. The first is "metatag_statement_groups" which allows to find sensors based on their metatags. The second is "sensor_statement_groups" which allows to find sensors based on their own properties. Supported properties are id, name, type, device_type, data_type_id, pager_type, display_name and use_data_storage.

URLhttps://api.sense-os.nl/groups/{group_id}/sensors/find
MethodPOST
Need AuthTrue

Request Headers

NameDefaultTypeStyleRequired
Accept*xsd:stringheaderTrue

Request Parameters

NameDescriptionType
detailsTo get all the related data as name, display_name, type, device_type, data_typ_id, pager_type, data_type and data_structure the parameter details=full can be used. If only a list of sensor id's is needed then details=no can be used. xsd:string
namespaceFind metatags attached to given namespace. If not given “default” is assumed as the namespace. xsd:string

Request Body

{
    "filter": {
        "metatag_statement_groups": [
            [
                {
                    "metatag_name": "greenhouse_number",
                    "operator": "equal",
                    "value": "1"
                },
                {
                    "metatag_name": "greenhouse_number",
                    "operator": "equal",
                    "value": "2"
                }
            ],
            [
                {
                    "metatag_name": "color",
                    "operator": "equal",
                    "value": "green"
                }
            ]
        ],
        "sensor_statement_groups": [
            [
                {
                    "sensor_property": "id",
                    "operator": "in",
                    "value": "1,2,3,4,5,6,7,8,9,10"
                }
            ]
        ]
    }
}

Get the metatags of serveral sensors: GET /sensors/metatags

This method will return a list of sensors with their metatags.

URLhttps://api.sense-os.nl/sensors/metatags
MethodGET
Need AuthTrue

Request Headers

NameDefaultTypeStyleRequired
Accept*xsd:stringheaderTrue

Request Parameters

NameDescriptionType
detailsTo get all the related data as name, display_name, type, device_type, data_typ_id, pager_type, data_type and data_structure the parameter details=full can be used. If only a list of sensor id's is needed then details=no can be used. xsd:string
namespaceFind metatags attached to given namespace. If not given "default" is assumed as the namespace. xsd:string
sensor_owner"me" only return metatags of sensors owned by the current user. "shared" only return sensors shared with me. "all" return all sensors owned by me or shared with me. When not given "me" is assumed xsd:string

Request Body

{
    "sensors": [
        {
            "id": "1",
            "name": "pwrmtr123",
            "display_name": "Power meter",
            "type": "1",
            "device_type": "BMA123",
            "data_type_id": "1",
            "pager_type": "email",
            "data_type": "json",
            "data_structure": "{\"x-axis\":\"float\",\"y-axis\":\"float\",\"z-axis\":\"float\"}",
            "metatags": {
                "measurement_type": [
                    "electricty_produced"
                ],
                "measurement_unit": [
                    "kWh"
                ],
                "measurement_interval": [
                    "15min",
                    "30min"
                ],
                "project": [
                    1
                ],
                "manufacturer": [
                    "philips"
                ],
                "manufacturer_modelnr": [
                    "3254"
                ],
                "manufacturer_model_name": [
                    "Powermeter"
                ],
                "heating_unit": [
                    "1"
                ]
            }
        },
        {
            "id": "2",
            "name": "pwrmtr123",
            "display_name": "Power meter",
            "type": "1",
            "device_type": "BMA123",
            "data_type_id": "1",
            "pager_type": "email",
            "data_type": "json",
            "data_structure": "{\"x-axis\":\"float\",\"y-axis\":\"float\",\"z-axis\":\"float\"}",
            "metatags": {
                "measurement_type": [
                    "electricty_produced"
                ],
                "measurement_unit": [
                    "kWh"
                ],
                "measurement_interval": [
                    "15min",
                    "30min"
                ],
                "project": [
                    1
                ],
                "manufacturer": [
                    "philips"
                ],
                "manufacturer_modelnr": [
                    "3254"
                ],
                "manufacturer_model_name": [
                    "Powermeter"
                ],
                "heating_unit": [
                    2
                ]
            }
        }
    ]
}

Removing sensor tags: DELETE /sensors/{id}/metatags

This method will delete all the metatags for the given sensor in the given namespace

URLhttps://api.sense-os.nl/sensors/{id}/metatags
MethodDELETE
Need AuthTrue

Request Headers

NameDefaultTypeStyleRequired
Accept*xsd:stringheaderTrue

Request Parameters

NameDescriptionType
namespaceFind metatags attached to given namespace. If not given "default" is assumed as the namespace. xsd:string

Replace metatags of a sensor: PUT /sensors/{id}/metatags

This method will persist a list of metatags to the given sensor. All metatags that are not mentioned in the uploaded list are removed from the sensor. Metatag names can have a maximum length of 32 (ASCII) characters. The metatag value can have a maximum length of 100 (UTF-8) characters. For now we impose a limit on the amount of metatags attached to a sensor in a single namespace. Currently this is set on 30.

URLhttps://api.sense-os.nl/sensors/{id}/metatags
MethodPUT
Need AuthTrue

Request Headers

NameDefaultTypeStyleRequired
Accept*xsd:stringheaderTrue

Request Parameters

NameDescriptionType
namespaceFind metatags attached to given namespace. If not given "default" is assumed as the namespace. xsd:string

Request Body

The sensor data object

{
    "metatags": {
        "measurement_type": [
            "electricty_produced",
            "electricty_consumed"
        ],
        "measurement_unit": [
            "kWh"
        ],
        "measurement_interval": [
            "15min",
            "30min"
        ],
        "project": [
            1
        ],
        "manufacturer_modelnr": [
            "3254"
        ],
        "manufacturer_model_name": [
            "Powermeter"
        ],
        "heating_unit": [
            2
        ]
    }
}

Finding distinct metatag values by metatag name: GET /sensors/metatag_name/{metatag_name}/distinct_values

Via this method a list of distinct metatag values can be retrieved that have the given metatag name.

URLhttps://api.sense-os.nl/sensors/metatagname/{metatagname}/distinct_values
MethodGET
Need AuthTrue

Request Headers

NameDefaultTypeStyleRequired
Accept*xsd:stringheaderTrue

Request Parameters

NameDescriptionType
namespaceFind metatags attached to given namespace. If not given "default" is assumed as the namespace. xsd:string

Finding sensors by metatags: POST /sensors/find

Via this method a list of sensors can be selected based on a set of conditions. Supported operators are "equal", "in", and "is_set". All string comparisons are case INsensitive. Currently supported are two types of statement groups. The first is "metatag_statement_groups" which allows to find sensors based on their metatags. The second is "sensor_statement_groups" which allows to find sensors based on their own properties. Supported properties are id, name, type, device_type, data_type_id, pager_type, display_name and use_data_storage.

URLhttps://api.sense-os.nl/sensors/find
MethodPOST
Need AuthTrue

Request Headers

NameDefaultTypeStyleRequired
Accept*xsd:stringheaderTrue

Request Parameters

NameDescriptionType
detailsTo get all the related data as name, display_name, type, device_type, data_typ_id, pager_type, data_type and data_structure the parameter details=full can be used. If only a list of sensor id's is needed then details=no can be used. xsd:string
namespaceFind metatags attached to given namespace. If not given "default" is assumed as the namespace. xsd:string
sensor_owner"me" only return metatags of sensors owned by the current user. "shared" only return sensors shared with me. "all" return all sensors owned by me or shared with me. When not given "me" is assumed xsd:string

Request Body

{
    "filter": {
        "metatag_statement_groups": [
            [
                {
                    "metatag_name": "greenhouse_number",
                    "operator": "equal",
                    "value": "1"
                },
                {
                    "metatag_name": "greenhouse_number",
                    "operator": "equal",
                    "value": "2"
                }
            ],
            [
                {
                    "metatag_name": "color",
                    "operator": "equal",
                    "value": "green"
                }
            ]
        ],
        "sensor_statement_groups": [
            [
                {
                    "sensor_property": "id",
                    "operator": "in",
                    "value": "1,2,3,4,5,6,7,8,9,10"
                }
            ]
        ]
    }
}

Finding distinct metatag values by metatag name: GET //metatag_name/{metatag_name}/distinct_values

Via this method a list of distinct metatag values can be retrieved that have the given metatag name.

URLhttps://api.sense-os.nl//metatagname/{metatagname}/distinct_values
MethodGET
Need AuthTrue

Request Headers

NameDefaultTypeStyleRequired
Accept*xsd:stringheaderTrue

Request Parameters

NameDescriptionType
namespaceFind metatags attached to given namespace. If not given "default" is assumed as the namespace. xsd:string