Skip to content

Commit 075345c

Browse files
Add Swagger 2.0 API documentation
1 parent 12f1064 commit 075345c

File tree

1 file changed

+152
-0
lines changed

1 file changed

+152
-0
lines changed
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
swagger: '2.0'
2+
info:
3+
description: 'Corona Virus Tracker API based on JHU data sets. https://github.com/ExpDev07/coronavirus-tracker-api'
4+
version: 1.0.0
5+
title: Corona Virus Tracker API
6+
contact:
7+
url: https://github.com/ExpDev07/coronavirus-tracker-api
8+
host: coronavirus-tracker-api.herokuapp.com
9+
basePath: /v2
10+
schemes:
11+
- https
12+
paths:
13+
/latest:
14+
get:
15+
summary: Latest global Corona stats
16+
operationId: latest
17+
produces:
18+
- application/json
19+
responses:
20+
'200':
21+
description: successful operation
22+
schema:
23+
type: object
24+
properties:
25+
latest:
26+
type: object
27+
properties:
28+
confirmed:
29+
type: number
30+
example: 214910
31+
deaths:
32+
type: number
33+
example: 8733
34+
recovered:
35+
type: number
36+
example: 83207
37+
/locations:
38+
get:
39+
summary: All Locations
40+
operationId: allLocations
41+
produces:
42+
- application/json
43+
parameters:
44+
- name: country_code
45+
in: query
46+
description: "ISO alpha 2 country code. https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2"
47+
required: false
48+
type: string
49+
x-example: US
50+
- name: timelines
51+
in: query
52+
description: "Include timeline objects in response? true or false"
53+
required: false
54+
type: string
55+
x-example: true
56+
responses:
57+
'200':
58+
description: successful operation
59+
schema:
60+
type: object
61+
properties:
62+
locations:
63+
type: array
64+
items:
65+
$ref: '#/definitions/Location'
66+
'/locations/{id}':
67+
get:
68+
summary: location
69+
operationId: location
70+
produces:
71+
- application/json
72+
parameters:
73+
- name: id
74+
in: path
75+
description: "Internal ID"
76+
required: true
77+
type: string
78+
x-example: 39
79+
responses:
80+
'200':
81+
description: successful operation
82+
schema:
83+
type: object
84+
properties:
85+
location:
86+
$ref: '#/definitions/Location'
87+
'404':
88+
description: Location not found
89+
definitions:
90+
Location:
91+
type: object
92+
properties:
93+
coordinates:
94+
type: object
95+
properties:
96+
latitude:
97+
type: string
98+
example: "47.4009"
99+
longitude:
100+
type: string
101+
example: "-121.4905"
102+
country:
103+
type: string
104+
example: "US"
105+
country_code:
106+
type: string
107+
example: US
108+
id:
109+
type: number
110+
example: 98
111+
latest:
112+
type: object
113+
properties:
114+
confirmed:
115+
type: number
116+
example: 1014
117+
deaths:
118+
type: number
119+
example: 55
120+
recovered:
121+
type: number
122+
example: 10
123+
province:
124+
type: string
125+
example: "Washington"
126+
timelines:
127+
type: object
128+
properties:
129+
confirmed:
130+
type: object
131+
properties:
132+
latest:
133+
type: number
134+
example: 1014
135+
timeline:
136+
type: object
137+
deaths:
138+
type: object
139+
properties:
140+
latest:
141+
type: number
142+
example: 55
143+
timeline:
144+
type: object
145+
recovered:
146+
type: object
147+
properties:
148+
latest:
149+
type: number
150+
example: 10
151+
timeline:
152+
type: object

0 commit comments

Comments
 (0)