此文档为开发HTTP接口的设计文档,目前用于提供天气查询的相关接口。
测试的时候使用 URL=http://www.dennisthink.com/test/api/weather/v1/
正式使用的时候 URL=http://www.dennisthink.com/api/weather/v1/
请求的json(无)
返回的json
{ "code": 0, "message": "SUCCEED", "body": { "version": "0.1.0" } }请求参数
token:向我申请 city_code:城市编号 date:日期返回的json:
{ "code": 0, "message": "SUCCEED", "body": { "city_code": "10029111810", "city_name": "番禺", "weather": "小雨", "high_temperature": "26℃", "low_temperature": "17℃", "air_quality": "小雨", "sun_up": "06:37", "sun_down": "18:35" } }请求的json
token:向我申请 city_name:城市名称,目前仅支持中文 date:日期返回的json:
{ "code": 0, "message": "SUCCEED", "body": { "city_code": "10011111410", "city_name": "海淀", "weather": "晴转多云转多云转晴", "high_temperature": "10℃", "low_temperature": "1℃", "air_quality": "晴转多云转多云转晴", "sun_up": "06:33", "sun_down": "18:17" } }请求的json
token:向我申请 city_name:城市名称,目前仅支持中文返回的json:
{ "code": 0, "message": "SUCCEED", "body": [ { "city_code": "10011111110", "city_name": "", "country": "中国", "province": "北京市", "city": "市辖区", "county": "朝阳区", "addr": "朝阳" }, { "city_code": "10016201417", "city_name": "", "country": "中国", "province": "辽宁省", "city": "辽阳市", "county": "朝阳市", "addr": "朝阳县" }, { "city_code": "10017111410", "city_name": "", "country": "中国", "province": "吉林省", "city": "长春市", "county": "朝阳区", "addr": "朝阳" } ] }请求的json
token:向我申请 city_code:城市编号 date:日期返回的json:
{ "code": 0, "message": "SUCCEED", "body": { "city_code": "10028201517", "city_name": "", "ultra_degree": "最弱", "ultra_detail": "辐射弱,涂擦SPF8-12防晒护肤品。", "cold_degree": "较易发", "cold_detail": "天凉,湿度大,较易感冒。", "clothes_degree": "较舒适", "clothes_detail": "建议穿薄外套或牛仔裤等服装。", "car_wash_degree": "不宜", "car_wash_detail": "有雨,雨水和泥水会弄脏爱车。", "air_fouling_degree": "良", "air_fouling_detail": "气象条件有利于空气污染物扩散。" } }请求的json
token:向我申请 city_code:城市编号 date:日期 hour:小时(24小时制)返回的json:
{ "code": 0, "message": "SUCCEED", "body": { "hour": "1", "weather": "", "air_quality": "", "temperature": "12", "relative_humidity": "96", "precipitation": "0.0", "wind_direction": "西北风", "wind_power": "0" } }请求的json
token:向我申请 city_code:城市编号 date:日期返回的json:
{ "code": 0, "message": "Succeed", "body": { "city_code": "1010101100", "city_name": "朝阳", "date":"", "detail":[ { "hour":"01", "weather":"天气", "air_quality":"空气质量", "temperature":"温度", "relative_humidity":"相对湿度", "precipitation":"降水", "wind_direction":"风向", "wind_power":"风力" }, { "hour":"02", "weather":"天气", "air_quality":"空气质量", "temperature":"温度", "relative_humidity":"相对湿度", "precipitation":"降水", "wind_direction":"风向", "wind_power":"风力" } ] } }提交的json
{ "email": "xxx@yyy.com", "city_code": "" }返回的json
{ "code": 0, "message": "succeed" }提交的json
{ "email": "xxx@yyy.com", "city_code": "" }返回的json
{ "code": 0, "message": "succeed" }提交的json
{ "email": "xxx@yyy.com",http://www.dennisthink.com/api/weather/v1/get_weather_by_city_code?token=1243234234&&city_code=100000000&&date=2018-01-01 }返回的json
{ "code": 0, "message": "succeed", "body": { "city_code_list": [ { "city_code": "", "city_name": "" }, { "city_code": "", "city_name": "" } ] } }转载于:https://www.cnblogs.com/Dennis-mi/p/8149025.html
相关资源:免费的天气服务api地址与请求格式