空气质量检测


空气质量监测接口返回示例

接口信息

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.Collections.Generic;

using System.Linq;

using System.Text;

using System.Net.Security;

using System.Security.Cryptography.X509Certificates;

using System.Net;

using System.IO;

using System.IO.Compression;

using System.Text.RegularExpressions;

using System.Web.Script.Serialization;

namespace map

{

    class Program

    {

        static void Main(string[] args)

        {

            string key = "**************************8";

            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();


        }

    }

}


你可能感兴趣的:(空气质量检测)