130 lines
4.2 KiB
YAML
130 lines
4.2 KiB
YAML
openapi: "3.1.0"
|
|
info:
|
|
title: 和风天气API
|
|
version: '1'
|
|
servers:
|
|
- url: https://devapi.qweather.com
|
|
components:
|
|
securitySchemes:
|
|
apiKey:
|
|
name: 'X-QW-Api-Key'
|
|
in: header
|
|
type: apiKey
|
|
security:
|
|
- apiKey: []
|
|
paths:
|
|
/v7/weather/now:
|
|
get:
|
|
operationId: getWeatherNow
|
|
summary: 获取实时天气
|
|
servers:
|
|
- url: https://devapi.qweather.com
|
|
parameters:
|
|
- name: location
|
|
in: query
|
|
required: true
|
|
description: >
|
|
需要查询地区的LocationID或以英文逗号分隔的经度, 纬度坐标(十进制,最多支持小数点后两位)。
|
|
LocationID可通过GeoAPI获取。例如:location=101010100 或 location=116.41,39.92
|
|
schema:
|
|
type: string
|
|
- name: lang
|
|
in: query
|
|
required: false
|
|
description: >
|
|
多语言设置,请阅读多语言文档,了解我们的多语言是如何工作、如何设置以及数据是否支持多语言。
|
|
schema:
|
|
type: string
|
|
- name: unit
|
|
in: query
|
|
required: false
|
|
description: >
|
|
数据单位设置,可选值包括unit=m(公制单位,默认)和unit=i(英制单位)。
|
|
更多选项和说明参考度量衡单位。
|
|
schema:
|
|
type: string
|
|
enum:
|
|
- m
|
|
- i
|
|
responses:
|
|
'200':
|
|
description: 返回天气数据
|
|
content:
|
|
application/json:
|
|
schema:
|
|
type: object
|
|
properties:
|
|
code:
|
|
type: string
|
|
example: "200"
|
|
updateTime:
|
|
type: string
|
|
format: date-time
|
|
example: "2020-06-30T22:00+08:00"
|
|
fxLink:
|
|
type: string
|
|
format: uri
|
|
example: "http://hfx.link/2ax1"
|
|
now:
|
|
type: object
|
|
properties:
|
|
obsTime:
|
|
type: string
|
|
format: date-time
|
|
example: "2020-06-30T21:40+08:00"
|
|
temp:
|
|
type: string
|
|
example: "24"
|
|
feelsLike:
|
|
type: string
|
|
example: "26"
|
|
icon:
|
|
type: string
|
|
example: "101"
|
|
text:
|
|
type: string
|
|
example: "多云"
|
|
wind360:
|
|
type: string
|
|
example: "123"
|
|
windDir:
|
|
type: string
|
|
example: "东南风"
|
|
windScale:
|
|
type: string
|
|
example: "1"
|
|
windSpeed:
|
|
type: string
|
|
example: "3"
|
|
humidity:
|
|
type: string
|
|
example: "72"
|
|
precip:
|
|
type: string
|
|
example: "0.0"
|
|
pressure:
|
|
type: string
|
|
example: "1003"
|
|
vis:
|
|
type: string
|
|
example: "16"
|
|
cloud:
|
|
type: string
|
|
example: "10"
|
|
dew:
|
|
type: string
|
|
example: "21"
|
|
refer:
|
|
type: object
|
|
properties:
|
|
sources:
|
|
type: array
|
|
items:
|
|
type: string
|
|
example: "QWeather"
|
|
license:
|
|
type: array
|
|
items:
|
|
type: string
|
|
example: "QWeather Developers License"
|