空气污染实况城市排名接口

From CaiyunWiki
Revision as of 05:31, 15 January 2019 by Liuzhonghua (talk | contribs) (授权与认证)
Jump to: navigation, search

授权与认证

请先至彩云开放平台注册,注册后可以获得 token 。开发者token需要额外开通权限,请联系商务:api@caiyunapp.com

把您的 token 拼到 API 请求的 URL 中,如: http://api.caiyunapp.com/v1/aqi/ranking?token=TAkhjf8d1nlSlspN

其中 TAkhjf8d1nlSlspN 就是一个共用测试 token 。不要把私有token 告诉任何人!

请求样例

http://api.caiyunapp.com/v1/aqi/ranking?token=TAkhjf8d1nlSlspN&field=pm25&type=desc&number=10
参数:

field 排名所用的变量:【'pm25', 'pm10', 'o3', 'no2', 'so2', 'co', 'aqi'】,默认pm25

type 排名所用的变量:【'asc', 'desc'】,默认asc(空气质量好的城市排名靠前)

number 排名返回的城市数量:<=200,默认100

返回结构和说明

status:	     ok
category:    aqi_latest_obs_city_ranking
result:	{
         0:{
               station_code:	"0000A01496",
               area:		"乌鲁木齐市",
               time_point:	"2019-01-15T12:00:00Z+08:00",
               lon:		"87.6444",
               lat:		"43.962",

               primary_pollutant:	"细颗粒物(PM2.5)",
               quality:			"严重污染",

               pm25:		"355",
               pm10:		"389",
               o3:		"20",
               no2:		"88",
               so2:		"20",
               co:		"4.8",
               aqi:		"404"
            },
         1: {...},
}