{ "swagger": "2.0", "info": { "version": "1.0.0", "title": "Care Pet", "description": "Care Pet monitoring system" }, "basePath": "/api", "schemes": [ "http" ], "consumes": [ "application/json" ], "produces": [ "application/json" ], "paths": { "/owner/{id}": { "get": { "description": "Find an owner with a specific ID", "operationId": "find owner by id", "parameters": [ { "name": "id", "in": "path", "description": "ID of an owner to fetch", "required": true, "type": "string", "format": "uuid" } ], "responses": { "200": { "description": "owner response", "schema": { "$ref": "#/definitions/Owner" } }, "default": { "description": "error", "schema": { "$ref": "#/definitions/Error" } } } } }, "/owner/{id}/pets": { "get": { "description": "Find the Pets that the owner tracks", "operationId": "find pets by owner id", "parameters": [ { "name": "id", "in": "path", "description": "ID of an owner pets to fetch", "required": true, "type": "string", "format": "uuid" } ], "responses": { "200": { "description": "pets response", "schema": { "type": "array", "items": { "$ref": "#/definitions/Pet" } } }, "default": { "description": "error", "schema": { "$ref": "#/definitions/Error" } } } } }, "/pet/{id}/sensors": { "get": { "description": "Find the Pet sensors", "operationId": "find sensors by pet id", "parameters": [ { "name": "id", "in": "path", "description": "ID of a pet sensors to fetch", "required": true, "type": "string", "format": "uuid" } ], "responses": { "200": { "description": "sensors response", "schema": { "type": "array", "items": { "$ref": "#/definitions/Sensor" } } }, "default": { "description": "error", "schema": { "$ref": "#/definitions/Error" } } } } }, "/sensor/{id}/values": { "get": { "description": "Read sensor data", "operationId": "find sensor data by sensor id and time range", "parameters": [ { "name": "id", "in": "path", "description": "ID of a sensor to fetch", "required": true, "type": "string", "format": "uuid" }, { "name": "from", "in": "query", "description": "from timestamp", "required": true, "type": "string", "format": "date-time" }, { "name": "to", "in": "query", "description": "to timestamp", "required": true, "type": "string", "format": "date-time" } ], "responses": { "200": { "description": "sensors response", "schema": { "type": "array", "items": { "type": "number", "format": "float" } } }, "default": { "description": "error", "schema": { "$ref": "#/definitions/Error" } } } } }, "/sensor/{id}/values/day/{day}": { "get": { "description": "Find a daily summary of hour based aggregates", "operationId": "find sensor avg by sensor id and day", "parameters": [ { "name": "id", "in": "path", "description": "ID of a sensor to fetch", "required": true, "type": "string", "format": "uuid" }, { "name": "day", "in": "path", "description": "average on a day", "required": true, "type": "string", "format": "date" } ], "responses": { "200": { "description": "sensor avg response", "schema": { "type": "array", "items": { "type": "number", "format": "float" } } }, "default": { "description": "error", "schema": { "$ref": "#/definitions/Error" } } } } } }, "definitions": { "Owner": { "type": "object", "required": [ "owner_id" ], "properties": { "owner_id": { "type": "string", "format": "uuid" }, "address": { "type": "string" }, "name": { "type": "string" } } }, "Pet": { "type": "object", "required": [ "owner_id", "pet_id" ], "properties": { "owner_id": { "type": "string", "format": "uuid" }, "pet_id": { "type": "string", "format": "uuid" }, "chip_id": { "type": "string" }, "species": { "type": "string" }, "breed": { "type": "string" }, "color": { "type": "string" }, "gender": { "type": "string" }, "age": { "type": "integer" }, "weight": { "type": "number" }, "address": { "type": "string" }, "name": { "type": "string" } } }, "Sensor": { "type": "object", "required": [ "pet_id", "sensor_id" ], "properties": { "pet_id": { "type": "string", "format": "uuid" }, "sensor_id": { "type": "string", "format": "uuid" }, "type": { "type": "string" } } }, "Measure": { "type": "object", "required": [ "sensor_id" ], "properties": { "sensor_id": { "type": "string", "format": "uuid" }, "ts": { "type": "string" }, "value": { "type": "number" } } }, "SensorAvg": { "type": "object", "required": [ "sensor_id" ], "properties": { "sensor_id": { "type": "string", "format": "uuid" }, "date": { "type": "string" }, "hour": { "type": "number" }, "value": { "type": "number" } } }, "Error": { "type": "object", "required": [ "code", "message" ], "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } } } }