:Multisensor


Label

Multisensor dataproduct

Description

This document describes the request and output parameters of multisensor dataproduct fetch.

Implementation  

{
    "openapi": "3.0.1",
    "info": {
        "contact": {
            "email": "support@cozify.fi"
        },
        "description": "This document describes the request and output parameters of multisensor dataproduct fetch.",
        "title": "Multisensor dataproduct",
        "version": "0.5"
    },
    "components": {
        "schemas": {
            "DataProductParameters": {
                "description": "The standard request data for multisensor dataproduct fetch. See https://docs.oftrust.net/#broker-v1-fetch-data-product",
                "properties": {
                    "timestamp": {
                        "description": "Standard Platform of Trust timestamp field for dataproduct fetch",
                        "type": "string"
                    },
                    "productCode": {
                        "description": "Product code of multisensor dataproduct",
                        "enum": ["cozify-multisensor-product"],
                        "type": "string"
                    },
                    "parameters": {
                        "description": "Parameters for user feedback fetch.",
                        "properties": {
                            "ids": {
                                "description": "List of search IDs. Search IDs are JSON objects for which the structure may vary depending on the data source system. For Cozify Hub, IDs are simple string objects containing a GUID.",
                                "type": "array",
                                "items": {
                                    "type": "object"
                                }
                            },
                            "startTime": {
                                "description": "Start time for the multisensor fetch. Returned measurements can not be older than this time. ISO8601 format, e.g. \"2021-06-16T08:02:14.3455+03:00\"",
                                "type": "string"
                            },
                            "endTime": {
                                "description": "End time for the multisensor fetch. Returned measurements can not be newer than this time. ISO8601 format, e.g. \"2021-06-16T08:02:14.3455+03:00\"",
                                "type": "string"
                            },
                            "dataTypes": {
                                "type": "array",
                                "items": {
                                    "description": "List of measurement types to query data for.",
                                    "type": "string",
                                    "enum": ["CO2", "Humidity", "Temperature"]
                                }
                            }
                        }
                    }
                }
            },
            "DataProductOutput": {
                "description": "The standard response data for multisensor dataproduct fetch. See https://docs.oftrust.net/#broker-v1-fetch-data-product",
                "properties": {
                    "data": {
                        "description": "The dataproduct specific response data for multisensor dataproduct fetch.",
                        "properties": {
                            "@context": {
                                "description": "Standard Platform of Trust Context field",
                                "type": "string"
                            },
                            "items": {
                                "description": "List of measurements for all sensors",
                                "type": "array",
                                "items": {
                                    "data": {
                                        "properties": {
                                            "timestamp": {
                                                "description": "Time for the user feedback. ISO8601 format, e.g. \"2021-06-16T08:02:14.3455+03:00\"",
                                                "type": "string"
                                            },
                                            "value": {
                                                "description": "Exact value for given measurement.",
                                                "type": "number"
                                            },
                                            "type": {
                                                "description": "Measurement type for given measurement.",
                                                "type": "string",
                                                "enum": [
                                                    "CO2",
                                                    "Humidity",
                                                    "Temperature"
                                                ]
                                            }
                                        }
                                    },
                                    "id": {
                                        "description": "Identifier for sensor/measurement point. Always matches one of the search IDs given in DataProductParameters.",
                                        "type": "string"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "paths": {
        "/broker/v1/fetch-data-product": {
            "post": {
                "description": "The standard Platform of Trust dataproduct fetch.",
                "requestBody": {
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/DataProductParameters"
                            },
                            "example": {
                                "timestamp": "2021-06-10T12:23:00.00+00:00",
                                "productCode": "cozify-multisensor-product",
                                "ids": [
                                    "8012c6b7-d72c-4f41-9dd2-109d19d6732f",
                                    "00df9cf1-5869-417f-88e8-a5148761d2fc"
                                ],
                                "startTime": "2021-06-10T11:23:00.00+00:00",
                                "endTime": "2021-06-10T12:23:00.00+00:00"
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/DataProductOutput"
                                },
                                "example": {
                                    "@context": "null",
                                    "signature": {
                                        "type": "RsaSignature2018",
                                        "created": "2021-06-16T08:11:16+00:00",
                                        "creator": "http://resources.cozify.fi/pot/cozify_pot_RS256.key.pub",
                                        "signatureValue": "I68+ur+da9IYB9JSj..."
                                    },
                                    "data": {
                                        "@context": "https://standards.oftrust.net/contexts/at_data_product_link.jsonld",
                                        "items": [
                                            {
                                                "data": [
                                                    {
                                                        "timestamp": "2021-06-10T11:28:20.174215+00:00",
                                                        "type": "Temperature",
                                                        "value": 22.15
                                                    },
                                                    {
                                                        "timestamp": "2021-06-10T11:35:20.174215+00:00",
                                                        "type": "Temperature",
                                                        "value": 22.45
                                                    },
                                                    {
                                                        "timestamp": "2021-06-10T11:28:20.174215+00:00",
                                                        "type": "CO2",
                                                        "value": 422
                                                    },
                                                    {
                                                        "timestamp": "2021-06-10T11:35:20.174215+00:00",
                                                        "type": "CO2",
                                                        "value": 430
                                                    },
                                                    {
                                                        "timestamp": "2021-06-10T11:28:20.174215+00:00",
                                                        "type": "Humidity",
                                                        "value": 34.6
                                                    },
                                                    {
                                                        "timestamp": "2021-06-10T11:35:20.174215+00:00",
                                                        "type": "Temperature",
                                                        "value": 35.3
                                                    }
                                                ],
                                                "id": "8012c6b7-d72c-4f41-9dd2-109d19d6732f"
                                            },
                                            {
                                                "data": [
                                                    {
                                                        "timestamp": "2021-06-10T11:28:20.174215+00:00",
                                                        "type": "Temperature",
                                                        "value": 21.25
                                                    },
                                                    {
                                                        "timestamp": "2021-06-10T11:35:20.174215+00:00",
                                                        "type": "Temperature",
                                                        "value": 21.35
                                                    },
                                                    {
                                                        "timestamp": "2021-06-10T11:28:20.174215+00:00",
                                                        "type": "CO2",
                                                        "value": 423
                                                    },
                                                    {
                                                        "timestamp": "2021-06-10T11:35:20.174215+00:00",
                                                        "type": "CO2",
                                                        "value": 429
                                                    },
                                                    {
                                                        "timestamp": "2021-06-10T11:28:20.174215+00:00",
                                                        "type": "Humidity",
                                                        "value": 33.6
                                                    },
                                                    {
                                                        "timestamp": "2021-06-10T11:35:20.174215+00:00",
                                                        "type": "Temperature",
                                                        "value": 34.3
                                                    }
                                                ],
                                                "id": "00df9cf1-5869-417f-88e8-a5148761d2fc"
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}