空气质量监测接口返回示例
接口信息 URL:http://apis.haoservice.com/air/cityair
支持格式:json
http请求方式:GET POST DEMO:http://apis.haoservice.com/air/cityair?city=城市名称&key=您申请的APPKEY值
返回结果: {
"error_code": 0,
"reason": "成功",
"result": {
"Ranking": 83,
"CityName": "深圳市",
"ProvinceName": "广东省",
"AQI": 58,
"Quality": "良",
"PM25": "36μg/m³",
"UpdateTime": "2014-04-27 21:00" }
}
演示示例代码:
using System;
using System.Text;
using System.Net;
namespace map
{
class Program
{
static void Main(string[] args)
{
string key = "1a2897d9723a45059fc6e6430b59adcc";
string city="北京";
string url = "http://apis.haoservice.com/air/cityair?city="+city+"&key="+key;
WebClient wc = new WebClient();
wc.Encoding = Encoding.UTF8;
string str = wc.DownloadString(url);
Console.WriteLine(str);
Console.ReadKey();
}
}
}