{"swagger":"2.0","info":{"version":"1.0.0","title":"A REST API for Sensor Data","description":"A REST API for Sensor Data"},"schemes":["https"],"securityDefinitions":{"accessCode":{"type":"oauth2","tokenUrl":"http://example.com/oauth/token","authorizationUrl":"http://example.com/oauth/auth","flow":"accessCode","scopes":{"write":"allows modifying resources","read":"allows reading resources"}}},"security":[{"accessCode":["read","write"]}],"paths":{"/stations":{"get":{"tags":["Stations"],"description":"Returns the list of active/inactive Stations.","operationId":"getStations","parameters":[{"in":"query","name":"offset","description":"Results offset","type":"integer","format":"int32","minimum":0},{"in":"query","name":"limit","description":"Results number","type":"integer","format":"int32","minimum":0}],"responses":{"200":{"description":"ok","schema":{"properties":{"results":{"$ref":"#/definitions/Paging"},"stations":{"items":{"$ref":"#/definitions/Station"}}}}}},"x-swagger-router-controller":"Stations"}},"/stations/{station_id}":{"get":{"tags":["Stations"],"description":"Return information of a specific Station.","operationId":"getStation","parameters":[{"in":"path","name":"station_id","type":"integer","required":true,"format":"int32","description":"station unique ID"}],"responses":{"200":{"description":"ok","schema":{"$ref":"#/definitions/Station"}}},"x-swagger-router-controller":"Stations"}},"/stations/{station_id}/sensors/":{"get":{"tags":["Sensors"],"description":"Returns List of Station's sensors","operationId":"getSensors","parameters":[{"in":"path","name":"station_id","type":"integer","required":true,"format":"int32","description":"station unique ID"},{"in":"query","name":"offset","description":"Resuls offset","type":"integer","format":"int32","minimum":0},{"in":"query","name":"limit","description":"Results number","type":"integer","format":"int32","minimum":0}],"responses":{"200":{"description":"ok","schema":{"properties":{"results":{"$ref":"#/definitions/Paging"},"sensors":{"items":{"$ref":"#/definitions/Sensor"}}}}}},"x-swagger-router-controller":"Stations"}},"/sensor/{sensor_id}":{"get":{"operationId":"getMeasurements","tags":["Sensors"],"parameters":[{"in":"path","name":"sensor_id","type":"integer","required":true,"format":"int32","description":"sensor unique ID"}],"responses":{"200":{"description":"ok","schema":{"$ref":"#/definitions/Sensor"}}}}},"/timeseries":{"get":{"operationId":"getTimeseries","tags":["Timeseries"],"parameters":[{"in":"query","name":"from","description":"Get Measurements from date-time","type":"string"},{"in":"query","name":"to","description":"Get Measurements to date-time","type":"string"},{"in":"query","name":"offset","description":"Resuls offset","type":"integer","format":"int32","minimum":0},{"in":"query","name":"limit","description":"Results number","type":"integer","format":"int32","minimum":0}],"responses":{"200":{"description":"ok","schema":{"properties":{"results":{"$ref":"#/definitions/Paging"},"timeseries":{"items":{"$ref":"#/definitions/Timeseries"}}}}}}}},"/timeseries/{sensor_id}":{"get":{"operationId":"getSensorTimeseries","tags":["Timeseries"],"parameters":[{"in":"path","name":"sensor_id","type":"integer","required":true,"format":"int32","description":"sensor unique ID"},{"in":"query","name":"from","description":"Get Measurements from date-time","type":"string"},{"in":"query","name":"to","description":"Get Measurements to date-time","type":"string"},{"in":"query","name":"offset","description":"Resuls offset","type":"integer","format":"int32","minimum":0},{"in":"query","name":"limit","description":"Results number","type":"integer","format":"int32","minimum":0}],"responses":{"200":{"description":"ok","schema":{"properties":{"results":{"$ref":"#/definitions/Paging"},"timeseries":{"items":{"$ref":"#/definitions/Measurement"}}}}}}}}},"definitions":{"Timeseries":{"type":"object","properties":{"station_id":{"type":"string"},"sensor_id":{"type":"string"},"measurements":{"items":{"$ref":"#/definitions/Measurement"}}}},"Paging":{"type":"object","properties":{"offset":{"type":"integer","example":0},"limit":{"type":"integer","example":100},"total":{"type":"integer","example":200}}},"Measurement":{"type":"object","properties":{"value":{"type":"integer","format":"decimal","example":24.5},"measuredAt":{"type":"string","example":"2017-01-12 18:45:00","pattern":"\\d{4}-\\d{1,2}-\\d{1,2} \\d{1,2}:\\d{1,2}:\\d{1,2}"}}},"Sensor":{"type":"object","properties":{"sens_id":{"type":"string","example":2},"sens_name":{"type":"string","example":"SM1"},"sens_channel":{"type":"integer","example":1},"sens_status":{"enum":["Active","Inactive"]},"sens_type":{"type":"string","enum":["Temperature","Soil Moisture","Et0"]},"sens_units":{"type":"string","enum":["Celcius","%","mg/m^2","other units here"]},"sens_last_measurement":{"type":"object","$ref":"#/definitions/Measurement"}}},"Station":{"type":"object","properties":{"st_id":{"type":"string","example":"f4a8d30e-420f-11e7-a919-92ebcb67fe33"},"st_name":{"type":"string","example":"Bihac"},"st_type":{"type":"string","example":"iMetos"},"st_lat":{"type":"number","format":"double","example":15.8521379},"st_lon":{"type":"number","example":44.8206266,"format":"double"},"st_network":{"type":"string","example":"Germany A"},"st_status":{"type":"string","enum":["Active","Inactive"],"example":"Active"},"st_serial":{"type":"string","example":"43423-2343-2332-2"},"st_description":{"type":"string","example":"Description of Station"},"st_active_sensors":{"type":"integer","example":12},"st_inactive_sensors":{"type":"integer","example":2},"st_timezone":{"type":"string","example":"UTC+2"},"st_created_at":{"type":"string","example":"2017-01-12 18:45:00","pattern":"\\d{4}-\\d{1,2}-\\d{1,2} \\d{1,2}:\\d{1,2}:\\d{1,2}"}}}},"host":"virtserver.swaggerhub.com","basePath":"/stekes/StationAPI/1.0.0"}