Use bo api to create weather check software, boapi

Source: Internet
Author: User

Use bo api to create weather check software, boapi

Let's take a look at the effect.

 

Interface address: http://service.boapi.net/Weather/Weather.ashx? Appkey = The appkey & city = city name you applied

Interface Description view http://www.boapi.net/weather.htm

Key code of request service

 

JToken WheatherJson (string city) {WebClient wc = new WebClient (); string json = ""; try {wc. encoding = System. text. encoding. UTF8; json = wc. downloadString ("http://service.boapi.net/Weather/Weather.ashx? Appkey = Your appkey & city = "+ city); return (JToken) JsonConvert. DeserializeObject (json);} catch {}}

Returned results

 

 

{"C": "101010100", "cn": "China", "pn": "Beijing", "dn": "Beijing", "unch ": "beijing", "unen": "beijing", "date": "11:00:00", "fw": [{"dph": "Qing", "dp ": "d00.gif", "nph": "Multi-cloud", "np": "n01.gif", "dt": "27", "nt": "14", "dwd ": "Nanfeng", "nwd": "Nanfeng", "dwp": "3-4", "nwp": "3-4", "ss ": "|" },{ "dph": "Cloudy", "dp": "d01.gif", "nph": "clear", "np": "n00.gif ", "dt": "29", "nt": "11", "dwd": "North Wind", "nwd": "No sustained wind direction", "dwp ": "Grade 3-4", "nwp": "Breeze", "ss": "|" },{ "dph": "clear", "dp ": "d00.gif", "nph": "clear", "np": "n00.gif", "dt": "27", "nt": "14", "dwd ": "No sustained wind direction", "nwd": "No sustained wind direction", "dwp": "Breeze", "nwp": "Breeze", "ss ": "05:24 | 19:01"}]}

Response parameter description

 

 

C City code Fi Weather index
Cn Country name Cin Chinese index name
Pn Name of a province/Municipality/Autonomous Region Ic Exponential level
Dn City name Ad Index suggestions
Unch Chinese city name    
Unen English city name    
Date Weather update time    
Fw Future weather    
Dph Daytime weather    
Dp Daytime weather icon    
Nph Night weather    
Np Weather icon at night    
Dt Daytime temperature    
Nt Night Temperature    
Dwd Daytime wind direction    
Nwd Night wind direction    
Dwp Daytime wind    
Nwp Night wind    
Ss Sunrise and sunset time

If you want to get more weather icons to http://www.boapi.net/TechBlog.aspx? Id = 1001 & blog = boapi download

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.