Publishing API for Dylos and Shinyei sensors

Note. The content on this page is outdated.
For the most recent upload API document, go to https://aqicn.org/data-feed/upload-api/

If you have a Dylos or Shinyei sensor, and you would like to publish its data on the World Air Quality Index, then this page is for you. One of the easiest solution for uploading the Dylos data is to use the ready made scripts available on github. But if you need to brew your own system, or upload data from the Shinyei sensor, then you can use the APIs described on this page.

Note that this API specification is not final, but still on-going work, so if you meet any difficulty with the integration, just contact us to get the support.


--

API Endpoint

http://sensor.aqicn.org/

API Method: Uploading data

post /sensor/upload
Parameters
  • id: Sensor ID, eg dylos.test-sensor-id
  • key: Sensor password - optional, only if the sensor ID is 'locked'.
  • time: Sensor time, with timezone information, in ISO 8601 format- eg 2014/10/08 18:03:45 +0800
  • location: Sensor position (latitude, longitude) - optional only if correlation with BAM sensor is requested

  • data: Array, containing all the raw readings
    • type: Sensor data type. For now, can be "dylos-0.5", "dylos-2.5", "shinyei-pdp42ns-2.5u" or "shinyei-pdp42ns-1u".
    • unit: Sensor data unit. For now, can be "pc" (particule count) or "lpo" (low pulse occupancy).
    • value: Sensor data reading. eg 94948 or 0.374

    Notes
    1. The above parameters are encapsulated within the argument 'postdata' of the post request.
    2. The LPO value must be between 0 and 1. 0 Means transparent, 1 Opaque. For more information on how to extrac the LPO from the Shinyei sensor, please refer to this page: api/shinyei.
Example:
...
Return value:
  • result: Can be either ok or error.

    In case of ok result, the returned value will contain the sensor id as well as the upload data ids (for information purpose only).
    ...

    In case of error, the returned value will contain a description (field msg) and an error code (field ecode) which can be one of the following:

    • 101: There are missing arugments from the posted data. Minimum arguments are id, time and data.
    • 102: Key is not valid - the sensor is protected by password and the provided password is not correct.
    • 103: No data posted (i.e empty array or data is not an array).
    • 104: Unit, type of value information not available from the data field.
    • 105: Sensor type is unknown.
    • 106: The field value is not numeric.
    • 107: Time string can not be decode (is it ISO 8601 complaiant?)
    • 108: SQL query failed.
    ...

Example

 $ curl -i "http://sensor.aqicn.org/sensor/upload/" -d 'postdata={id:"dylos.test-sensor-id",time:"2014-10-16T19:20:31+08:00",data:[{type:"dylos-2.5",value:88,unit:"pc"}]}'

HTTP/1.1 200 OK
Date: Sun, 09 Nov 2014 08:28:34 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.3.3
Vary: Accept-Encoding
Connection: close
Transfer-Encoding: chunked
Content-Type: text/json; charset=utf-8

{"result":"ok","sensorID":"588","dataids":[2825275]}


API Method: Getting the raw sensor data

get /sensor/download
Parameters
  • id: Sensor ID, eg dylos.test-sensor-id
  • callback: Optional JsonP callback (eg "foo").
Example :
 http://sensor.aqicn.org/sensor/download/?id=dylos.test-sensor-id&callback=foo 

Return value:
...

Example

 $ curl -i "http://sensor.aqicn.org/sensor/download/?id=dylos.test-sensor-id&callback=foo"

HTTP/1.1 200 OK
Date: Sun, 09 Nov 2014 08:42:12 GMT
Server: Apache/2.2.15 (CentOS)
X-Powered-By: PHP/5.3.3
Vary: Accept-Encoding
Connection: close
Transfer-Encoding: chunked
Content-Type: text/json; charset=utf-8

{"id":"dylos.test-sensor-id","data":{"dylos-0.5":[{"time":"1413458432","value":"89"}],"dylos-2.5":[{"time":"1413458432","value":"89"},{"time":"1413458431","value":"88"}]}}


关于空气质量与空气污染指数

本网站采用的污染指数和颜色与EPA是完全相同的。 EPA的指数可以从 AirNow上查到

空气质量指数 空气质量指数级别(状况)及表示颜色 对健康影响情况 建议采取的措施
0 - 50 一级(优) 空气质量令人满意,基本无空气污染 各类人群可正常活动
51 -100 二级(良) 空气质量可接受,但某些污染物可能对极少数异常敏感人群健康有较弱影响 极少数异常敏感人群应减少户外活动
101-150 三级(轻度污染) 易感人群症状有轻度加剧,健康人群出现刺激症状 儿童、老年人及心脏病、呼吸系统疾病患者应减少长时间、高强度的户外锻炼
151-200 四级(中度污染) 进一步加剧易感人群症状,可能对健康人群心脏、呼吸系统有影响 儿童、老年人及心脏病、呼吸系统疾病患者避免长时间、高强度的户外锻炼,一般人群适量减少户外运动
201-300 五级(重度污染) 心脏病和肺病患者症状显著加剧,运动耐受力降低,健康人群普遍出现症状 儿童、老年人及心脏病、肺病患者应停留在室内,停止户外运动,一般人群减少户外运动
300+ 六级(严重污染) 健康人群运动耐受力降低,有明显强烈症状,提前出现某些疾病 儿童、老年人和病人应停留在室内,避免体力消耗,一般人群避免户外活动
(参考详见 http://zh.wikipedia.org/wiki/空气质量指数)

如果你想了解更多有关空气质量与污染,详见维基百科或者 AirNow

有关健康建议详见北京的Richard Saint Cyr MD医生的博客:www.myhealthbeijing.com


注意事项: 所有空气质量数据在发布时均未经验证,并且为了保证数据质量,这些数据可能随时被修改,恕不另行通知。 世界空气质量指数项目在编制此信息的内容时已经运用了所有合理的技能和谨慎,在任何情况下世界空气质量指数项目团队或其代理人将不会为由于提供此数据而直接或间接引起的伤害、合同损失、侵权及其他任何损失负责。



设置


选择语言:


Temperature unit:
Celcius