- 省份获取:
http://www.nmc.cn/rest/province
- 城市获取:
http://www.nmc.cn/rest/province/{省份代码}
- 城市天气预报获取:
http://www.nmc.cn/rest/weather?stationid={城市代码}
String url = "http://www.nmc.cn/rest/weather?stationid=56294";
System.Net.WebClient client = new WebClient();
string content = client.DownloadString(url);
代码如下:
[HttpPost]
/// <summary>
/// 返回当前城市的天气
/// </summary>
/// <param name="InputObj">Date</param>
/// <returns></returns>
public ResultModel WeatherResultQuery([FromBody] dynamic InputObj)
{
ErrType ErrType_Run = ErrType.Run_Other;
ResultModel RtnVal = new ResultModel();
JObject RtnData = new JObject();