{"swaggerDoc":{"swagger":"2.0","info":{"description":"Get messages from a specific Egg or topic over a period of time, optionally filtered by location. https://airqualityegg.com/api. Authentication using JWT tokens, include header Authorization Bearer your-jwt-token-here. An alternative is to provide an API Key in the 'apiKey' query string parameter, which you can obtain by logging into the Air Quality Egg Web Portal at https://airqualityegg.com/portal, clicking your email address in the top-right, then Account Settings, where your API key is displayed at the bottom (where it can also be changed). API Keys are 31 characters in length and consist of 4 groups of 7 characters separated by dashes (e.g. XXXXXXX-XXXXXXX-XXXXXXX-XXXXXXX). Proxying requests through your own server and using JWT is a more secure method of accessing the API.","version":"1.0.0","title":"Air Quality Egg Messages API","contact":{"email":"support@airqualityegg.com"},"license":{"name":"Apache 2.0","url":"http://www.apache.org/licenses/LICENSE-2.0.html"}},"schemes":["https"],"paths":{"/api/v2/login":{"post":{"tags":["developers"],"summary":"logs in to get JWT token","description":"logs in as a user and gets back a JWT on success","operationId":"login","parameters":[{"in":"body","name":"user","required":false,"schema":{"$ref":"#/definitions/user"}}],"responses":{"200":{"description":"An object with a jwt field containing the JSON Web Token for subsequent use in Authorization HTTP header. A failure to login will generally be accompanied by an error field explaining why.","schema":{"$ref":"#/definitions/User"}},"422":{"description":"bad input parameter"}}}},"/api/v2/most-recent/messages/device/{serial_number}":{"get":{"tags":["developers"],"summary":"gets an Egg's most recently reported data","description":"Gets an object representing the most recent message sent to each topic by a specific Egg. The specific keys of the returned object will depend on the type of Egg and what it reports. These keys are taken directly from MQTT topic string using the part after 'aqe/' and before '/serial-number'. The objects attached to each of these keys are the most recent payload reported by the Egg on that topic, augmented with a 'date' field which is a ISO-8601 formatted timestmap associated with that particular message. Also optionally accepts a comma separated list of serial numbers, in which case the result is an array of objects instead of a singular object.\n","operationId":"mostRecentMessagesBySerialNumber","produces":["application/json"],"parameters":[{"name":"serial_number","in":"path","description":"Egg serial number, typically starts with egg0080, or for Zynect sensors the 5-letter short code on the back of the unit","required":true,"type":"string"},{"name":"Authorization","in":"header","description":"should be a string of the form \"Bearer your-jwt-here\"","required":false,"type":"string"},{"name":"apiKey","in":"query","required":false,"type":"string","description":"4 groups of 7 characters separated by dashes (e.g. XXXXXXX-XXXXXXX-XXXXXXX-XXXXXXX) - 31 total characters in length, all capital letters and numbers"},{"name":"reduced","in":"query","description":"if provided and set to 1, reduces messages to canonical / ongtological {time, value, units} objects","type":"number","required":false}],"responses":{"200":{"description":"Most recent record messages on each topic from target Egg","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/definitions/RecentMessages"}}},"text/csv":{"schema":{"type":"string"}}}},"422":{"description":"bad input parameter"}}}},"/api/v2/messages/device/{serial_number}":{"get":{"tags":["developers"],"summary":"gets messages by serial number","description":"By passing in the appropriate options, you can get back messages published by a specific Egg over a period of time (required start-date + end-date, or start-date + dur, or end-date + dur). Also optionally accepts a comma separated list of serial numbers.\n","operationId":"messagesBySerialNumber","produces":["application/json"],"parameters":[{"name":"serial_number","in":"path","description":"Egg serial number, typically starts with egg0080, or for Zynect sensors the 5-letter short code on the back of the unit","required":true,"type":"string"},{"name":"Content-Disposition","in":"header","description":"should be a string like one of theses: \"inline\" will display the response; \"attachment\" (default) will download the data as a csv file named for the provided Serial Number; \"attachment; filename=\"filename.csv\"\" will download the data as a csv file named \"filename.csv\"","required":false,"type":"string"},{"name":"Authorization","in":"header","description":"should be a string of the form \"Bearer your-jwt-here\"","required":false,"type":"string"},{"name":"apiKey","in":"query","required":false,"type":"string","description":"4 groups of 7 characters separated by dashes (e.g. XXXXXXX-XXXXXXX-XXXXXXX-XXXXXXX) - 31 total characters in length, all capital letters and numbers"},{"name":"format","in":"query","required":false,"type":"string","description":"set to csv returns data in a comma separated file format. Anything else (including not provided) results in data returned in JSON format, respecting the reduced and grouped parameters below"},{"name":"columns","in":"query","required":false,"type":"string","description":"when using format=csv, this can be columns can be optionally be supplied as a comma separated list of column headings (without units) corresponding to sensor names (e.g. co, no2, so2, o3, pm10p0, pm2p5, pm1p0, co2, voc, temperature, humidity, pressure, and corresponding names with _aqi as a suffix gives aqi calculated based on just that sensor) and the csv returned will have time, serial_number, and the headings you requet in order."},{"name":"start-date","in":"query","description":"ISO-8601 date string marking the beginning of the requested time period.","required":false,"type":"string"},{"name":"end-date","in":"query","description":"ISO-8601 date string marking the end of the requested time period","required":false,"type":"string"},{"name":"dur","in":"query","description":"ISO-8601 duration string to be used in conjunction with _either_ start-date or end-date, not both","required":false,"type":"string"},{"name":"resolution","in":"query","description":"ISO-8601 duration string (e.g. PT1H for 1-hour, PT30M for 30-minutes) which, if provided, calculated centered averages at the specified resolution","required":false,"type":"string"},{"name":"reduced","in":"query","description":"if provided and set to 1, reduces messages to canonical / ongtological {time, value, units} objects","type":"number","required":false},{"name":"grouped","in":"query","description":"if provided and set to 1, groups messages by sensor type rather than in a flat heterogeneous array","type":"number","required":false},{"name":"lat","in":"query","description":"Decimal value of latitude for proximity filter (in degrees)","required":false,"type":"number"},{"name":"lon","in":"query","description":"Decimal value of longitude for proximity filter (in degrees)","required":false,"type":"number"},{"name":"radius","in":"query","description":"Decimal value of radius for proximity filter (in meters) limited to ~200 miles","required":false,"type":"number"}],"responses":{"200":{"description":"messages from target Egg matching temporal and spatial filter criteria","schema":{"type":"array","items":{"$ref":"#/definitions/Message"}}},"422":{"description":"bad input parameter"}}}},"/api/v2/messages/topic/{topic}":{"get":{"tags":["developers"],"summary":"gets messages by MQTT topic","description":"By passing in the appropriate options, you can get back messages published to a specific topic over a period of time (required start-date + end-date, or start-date + dur, or end-date + dur). Replace the trailing serial-number in a topic to get back messages from _any_ Egg on that topic prefix (e.g. /orgs/wd/aqe/temperature/#) matching the temporal and spatial filters.\n","operationId":"messagesByTopic","produces":["application/json"],"parameters":[{"name":"topic","in":"path","description":"an mqtt topic string, typically starts with /orgs/wd/aqe/","required":true,"type":"string"},{"name":"Authorization","in":"header","description":"should be a string of the form \"Bearer your-jwt-here\"","required":false,"type":"string"},{"name":"apiKey","in":"query","required":false,"type":"string","description":"4 groups of 7 characters separated by dashes (e.g. XXXXXXX-XXXXXXX-XXXXXXX-XXXXXXX) - 31 total characters in length, all capital letters and numbers"},{"name":"start-date","in":"query","description":"ISO-8601 date string marking the beginning of the requested time period.","required":false,"type":"string"},{"name":"end-date","in":"query","description":"ISO-8601 date string marking the end of the requested time period","required":false,"type":"string"},{"name":"dur","in":"query","description":"ISO-8601 duration string to be used in conjunction with _either_ start-date or end-date, not both","required":false,"type":"string"},{"name":"lat","in":"query","description":"Decimal value of latitude for proximity filter (in degrees)","required":false,"type":"number"},{"name":"lon","in":"query","description":"Decimal value of longitude for proximity filter (in degrees)","required":false,"type":"number"},{"name":"radius","in":"query","description":"Decimal value of radius for proximity filter (in meters) limited to ~200 miles","required":false,"type":"number"}],"responses":{"200":{"description":"messages from target topic matching temporal and spatial filter criteria","schema":{"type":"array","items":{"$ref":"#/definitions/Message"}}},"422":{"description":"bad input parameter"}}}}},"definitions":{"Message":{"type":"object","required":["date","payload","topic"],"properties":{"topic":{"type":"string","example":"/orgs/wd/aqe/temperature/eggxyz"},"date":{"type":"string","example":"2016-08-29T09:12:33.001Z"},"payload":{"type":"object","example":{"serial-number":"eggxyz","compensated-value":23.25,"converted-units":"degC"},"properties":{}}}},"RecentMessages":{"type":"object","required":["serial_number"],"properties":{"serial_number":{"type":"string","example":"eggxyz"},"last_report":{"type":"string","example":"2018-04-02T20:14:22-05:00"},"some-sensor":{"type":"object","example":{"serial-number":"eggxyz","compensated-value":23.25,"converted-units":"degC"},"properties":{}},"some-other-sensor":{"type":"object","example":{"serial-number":"eggxyz","a-special-value":213.25,"converted-units":"whatever-units"},"properties":{}}}},"User":{"type":"object","required":[],"properties":{"jwt":{"type":"string","example":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiYWRtaW4iOnRydWV9.TJVA95OrM7E2cBab30RMHrHDcEfxjoYZgeFONFh7HgQ"}}},"user":{"type":"object","required":["name","password"],"properties":{"name":{"type":"string"},"password":{"type":"string"}}}}},"customOptions":{}}