Skip to content
Permalink
56aa832405
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
365 lines (362 sloc) 11.5 KB
openapi: 3.0.0
info:
title: Weather API
description: API for fetching weather data
version: 1.0.0
servers:
- url: http://localhost:3000
paths:
/uv-index/{cityname}:
get:
summary: Get UV index by city name
parameters:
- in: path
name: cityname
schema:
type: string
required: true
description: Name of the city
responses:
"200":
description: UV index data
content:
application/json:
schema:
type: object
properties:
lat:
type: number
lon:
type: number
date_iso:
type: string
format: date-time
date:
type: integer
value:
type: number
example:
lat: 51.5085
lon: -0.1257
date_iso: "2024-07-03T12:00:00Z"
date: 1720008000
value: 6.54
"500":
description: Server error
/forecast/{cityname}:
get:
summary: Get weather forecast by city name
parameters:
- in: path
name: cityname
schema:
type: string
required: true
description: Name of the city
responses:
"200":
description: Weather forecast data
content:
application/json:
schema:
type: object
properties:
cod:
type: string
message:
type: integer
cnt:
type: integer
list:
type: array
items:
type: object
properties:
dt:
type: integer
main:
type: object
properties:
temp:
type: number
feels_like:
type: number
temp_min:
type: number
temp_max:
type: number
pressure:
type: integer
sea_level:
type: integer
grnd_level:
type: integer
humidity:
type: integer
temp_kf:
type: number
weather:
type: array
items:
type: object
properties:
id:
type: integer
main:
type: string
description:
type: string
icon:
type: string
clouds:
type: object
properties:
all:
type: integer
wind:
type: object
properties:
speed:
type: number
deg:
type: integer
gust:
type: number
visibility:
type: integer
pop:
type: number
sys:
type: object
properties:
pod:
type: string
dt_txt:
type: string
city:
type: object
properties:
id:
type: integer
name:
type: string
coord:
type: object
properties:
lat:
type: number
lon:
type: number
country:
type: string
population:
type: integer
timezone:
type: integer
sunrise:
type: integer
sunset:
type: integer
example:
cod: "200"
message: 0
cnt: 40
list:
- dt: 1720083600
main:
temp: 15.17
feels_like: 14
temp_min: 15.17
temp_max: 15.17
pressure: 1010
sea_level: 1010
grnd_level: 1007
humidity: 48
temp_kf: 0
weather:
- id: 800
main: Clear
description: clear sky
icon: 01d
clouds:
all: 0
wind:
speed: 5.32
deg: 279
gust: 7.78
visibility: 10000
pop: 0
sys:
pod: d
dt_txt: "2024-07-04 09:00:00"
city:
id: 2643743
name: London
coord:
lat: 51.5085
lon: -0.1257
country: GB
population: 1000000
timezone: 3600
sunrise: 1719978552
sunset: 1720038003
"500":
description: Server error
/visibility/{cityname}:
get:
summary: Get visibility by city name
parameters:
- in: path
name: cityname
schema:
type: string
required: true
description: Name of the city
responses:
"200":
description: Visibility data
content:
application/json:
schema:
type: object
properties:
visibility:
type: integer
example:
visibility: 10000
"500":
description: Server error
/weather/{cityname}:
get:
summary: Get current weather by city name
parameters:
- in: path
name: cityname
schema:
type: string
required: true
description: Name of the city
responses:
"200":
description: Current weather data
content:
application/json:
schema:
type: object
properties:
coord:
type: object
properties:
lon:
type: number
lat:
type: number
weather:
type: array
items:
type: object
properties:
id:
type: integer
main:
type: string
description:
type: string
icon:
type: string
base:
type: string
main:
type: object
properties:
temp:
type: number
feels_like:
type: number
temp_min:
type: number
temp_max:
type: number
pressure:
type: integer
humidity:
type: integer
sea_level:
type: integer
grnd_level:
type: integer
visibility:
type: integer
wind:
type: object
properties:
speed:
type: number
deg:
type: integer
clouds:
type: object
properties:
all:
type: integer
dt:
type: integer
sys:
type: object
properties:
type:
type: integer
id:
type: integer
country:
type: string
sunrise:
type: integer
sunset:
type: integer
timezone:
type: integer
id:
type: integer
name:
type: string
cod:
type: integer
example:
coord:
lon: -0.1257
lat: 51.5085
weather:
- id: 804
main: Clouds
description: overcast clouds
icon: 04d
base: stations
main:
temp: 15.65
feels_like: 15.33
temp_min: 14.36
temp_max: 17.22
pressure: 1008
humidity: 79
sea_level: 1008
grnd_level: 1005
visibility: 10000
wind:
speed: 5.14
deg: 190
clouds:
all: 100
dt: 1720005732
sys:
type: 2
id: 2075535
country: GB
sunrise: 1719978552
sunset: 1720038003
timezone: 3600
id: 2643743
name: London
cod: 200
"500":
description: Server error