-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathswagger.yaml
166 lines (166 loc) · 4.35 KB
/
swagger.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# this is an example of the Uber API
# as a demonstration of an API spec in YAML
swagger: '2.0'
info:
title: Finch API
description: Finch API Reference
version: "0.1.0"
# the domain of the service
host: api.usefinch.co
# array of all schemes that your API supports
schemes:
- https
# will be prefixed to all paths
basePath: /v1
produces:
- application/json
paths:
/users:
post:
summary: Create new user
parameters:
- name: body
in: body
description: User definition
required: true
schema:
type: object
required:
- name
- email
properties:
name:
type: string
email:
type: string
responses:
200:
description: Generated user token
examples:
application/json:
status: success
data:
token: Some JWT
/alerts:
parameters:
- name: Authorization
in: header
required: true
type: string
default: "Bearer "
description: "JSON Web Token (JWT) obtained from /users endpoint."
get:
summary: Get alerts of user
responses:
200:
description: Alerts of user
post:
summary: Create new alert
parameters:
- name: body
in: body
description: Alert definition
required: true
schema:
type: object
required:
- channel
properties:
name:
type: string
description: An identifier for alert.
channel:
type: string
enum:
- http
url:
type: string
description: Required if channel is http. URL to send the requests to.
method:
type: string
enum:
- GET
- POST
contentType:
type: string
enum:
- text/plain
- application/json
- application/x-www-form-urlencoded
data:
type: string
description: Plain text to post with the request body.
alertAfter:
type: integer
format: int32
description: Send the alert after x seconds. Overrides alertDate.
alertDate:
type: string
description: Send the alert at specified ISO 8601 date.
repeatEvery:
type: integer
description: Repeat the alert every x seconds.
repeatCount:
type: integer
description: Repeat the alert x times.
default: 3
responses:
200:
description: Generated user token
examples:
application/json:
status: success
/alerts/{alertId}:
parameters:
- name: Authorization
in: header
required: true
type: string
default: "Bearer "
description: "JSON Web Token (JWT) obtained from /users endpoint."
- name: alertId
in: path
type: string
required: true
description: Alert ID
get:
summary: Get alert details
responses:
200:
description: Alert details
patch:
summary: Update alert
parameters:
- name: body
in: body
description: Fields to update
required: true
schema:
type: object
required:
- enabled
properties:
enabled:
type: boolean
default: true
responses:
200:
description: Success message
/alerts/{alertId}/history:
parameters:
- name: Authorization
in: header
required: true
type: string
default: "Bearer "
description: "JSON Web Token (JWT) obtained from /users endpoint."
- name: alertId
in: path
type: string
required: true
description: Alert ID
get:
summary: Get process history of alert for last 100 events
responses:
200:
description: Process alert history