-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc3.raml
More file actions
264 lines (256 loc) · 7.84 KB
/
c3.raml
File metadata and controls
264 lines (256 loc) · 7.84 KB
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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
#%RAML 0.8
---
title: C3 Beacon
baseUri: http://api.c3wireless.com/{version}
version: v2
securitySchemes:
- oauth_2_0:
description: |
C3 supports OAuth 2.0 for authenticating all API requests.
type: OAuth 2.0
describedBy:
headers:
Authorization:
description: |
Used to send a valid OAuth 2 access token. Do not use
with the "access_token" query string parameter.
type: string
queryParameters:
access_token:
description: |
Used to send a valid OAuth 2 access token. Do not use together with
the "Authorization" header
type: string
responses:
401:
description: |
Bad or expired token. This can happen if the user or C3
revoked or expired an access token. To fix, you should re-
authenticate the user.
403:
description: |
Bad OAuth request (wrong consumer key, bad nonce, expired
timestamp...). Unfortunately, re-authenticating the user won't help here.
settings:
authorizationUri: https://{baseUri}/oauth2/authorize
accessTokenUri: https://{baseUri/oauth2/token
authorizationGrants: [ code, token ]
resourceTypes:
- collection:
description: Collection of available <<resourcePathName>>
get:
description: Get a list of <<resourcePathName>>
body:
application/json:
text/html:
example: null
responses:
200:
body:
application/json:
schema: <<resourcePathName>>
example: <<exampleCollection>>
post:
description: Add a new <<resourcePathName|!singularize>>
body:
application/json:
schema: <<resourcePathName|!singularize>>
example: <<exampleItem>>
responses:
201:
body:
application/json:
schema: genResponse
example: !include 201.sample
400:
description: Error in submitted data
body:
application/json:
schema: genResponse
example: !include 400.sample
- collection-readonly:
description: Collection of <<resourcePathName>>
get:
description: Get a list of <<resourcePathName>>
body:
application/json:
text/html:
example: null
responses:
200:
body:
application/json:
schema: <<resourcePathName>>
example: <<exampleCollection>>
- collection-item:
get:
description: |
Retrieve a known <<resourcePathName|!singularize>>
body:
application/json:
text/html:
example: null
responses:
200:
body:
application/json:
schema: <<resourcePathName|!singularize>>
example: <<exampleItem>>
404:
description: |
Requested <<resourcePathName|!singularize>> not found
body:
application/json:
schema: genResponse
example: !include 404.sample
put:
description: |
Update a known <<resourcePathName|!singularize>>
responses:
200:
description: <<resourcePathName|!singularize>> updated successfully
body:
application/json:
schema: <<resourcePathName|!singularize>>
example: |
<<exampleItem>>
404:
description: <<resourcePathName|!singularize>> not found
body:
application/json:
schema: genResponse
example: !include 404.sample
delete:
description: Delete a <<resourcePathName|!singularize>>
responses:
200:
description: <<resourcePathName|!singularize>> successfully deleted
body:
application/json:
schema: genResponse
example: !include 200.sample
404:
description: <<resourcePathName|!singularize>> record not found
body:
application/json:
schema: genResponse
example: !include 404.sample
/users:
type:
collection:
exampleCollection: !include user-collection.sample
exampleItem: !include user.sample
get:
is: [
searchable: {
description: "with valid fields: username",
example: "[\"username\", \"jackson\", \"=\"]"
},
pageable
]
/{user_id}:
type:
collection-item:
exampleItem: !include user.sample
/listeners:
type:
collection:
exampleCollection: !include listener-collection.sample
exampleItem: !include listener.sample
get:
is: [
searchable: {
description: "with valid fields: mac, zone_id, missing",
example: "[\"zone_id\", \"24\", \"=\"]"
},
pageable
]
/{listener_id}:
type:
collection-item:
exampleItem: !include listener.sample
/beacons:
type:
collection:
exampleCollection: !include beacon-collection.sample
exampleItem: !include beacon.sample
get:
is: [
searchable: {
description: "with valid fields: mac, major, minor, uuid, missing, last_battery, zone_id",
example: "[\"zone_id\", \"24\", \"=\"]"
},
pageable
]
/{beacon_id}:
type:
collection-item:
exampleItem: !include beacon.sample
/history:
type:
collection-readonly:
exampleCollection: !include history-collection.sample
get:
is: [
pageable,
searchable: {
description: "with valid fields: timestamp, zone_id, state",
example: "[\"zone_id\", \"24\", \"=\"]"
}
]
/zones:
type:
collection:
exampleCollection: !include zone-collection.sample
exampleItem: !include zone.sample
get:
is: [ pageable ]
/{zone_id}:
type:
collection-item:
exampleItem: !include zone.sample
traits:
- searchable:
queryParameters:
query:
description: |
JSON array [{"field1","value1","operator1"},{"field2","value2","operator2"},...,{"fieldN","valueN","operatorN"}] <<description>>
example: |
<<example>>
- orderable:
queryParameters:
orderBy:
description: |
Order by field: <<fieldsList>>
type: string
required: false
order:
description: Order
enum: [desc, asc]
default: desc
required: false
- pageable:
queryParameters:
offset:
description: Skip over a number of elements by specifying an offset value for the query
type: integer
required: false
example: 20
default: 0
limit:
description: Limit the number of elements on the response
type: integer
required: false
example: 80
default: 10
schemas:
- genResponse: !include generic.schema
- user: !include user.schema
- users: !include user-collection.schema
- listener: !include listener.schema
- listeners: !include listener-collection.schema
- beacon: !include beacon.schema
- beacons: !include beacon-collection.schema
- zone: !include zone.schema
- zones: !include zone-collection.schema
- history: !include history-collection.schema