forked from jarrodek/ChromeRestClient
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapi.raml
More file actions
368 lines (368 loc) · 13.9 KB
/
Copy pathapi.raml
File metadata and controls
368 lines (368 loc) · 13.9 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
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
#%RAML 1.0
title: Advanced Rest Client
version: v2
baseUri: https://api.advancedrestclient.com/{version}
description: |
A backend API for Advanced Rest Client APP.
The API is based on Google Cloud Endpoinds. Therefore OAuth2 authentication using Google account is required.
All request are restricted to the authorized user. Valid Bearer token in the Authorization header is required.
documentation:
- title: Gettng started
content: !include docs/gettings-started.md
mediaType: application/json
protocols: HTTPS
types:
RequestListSchema: !include schemas/requestlist.schema
RequestSchema: !include schemas/request.schema
PermissionSchema: !include schemas/permission.schema
PermissionListSchema: !include schemas/permissionlist.schema
HarSchema: !include schemas/har/log.json
ProjectSchema: !include schemas/project.schema
ProjectListSchema: !include schemas/projectlist.schema
AppResponse:
type: object
description: |
App response is a base response object from the server.
Every other response from the server must extend this base object.
SessionState:
type: object
description: |
Object represents relevant information about the user.
properties:
consent:
type: boolean
description: |
This will be set to true if the user consent to terms and conditions.
It also means that there is a UserObject entity in the datastore which may only be created when the user consent to data storing agreement.
There is no actuall `consent` field in the datastore.
New API users will have it set to false even if they have stored data in the backed. In old API there were no consent screen. The app must inform the user that the data will be deleted if he won't consent to the terms (when newApi set to false).
newApi:
type: boolean
description: |
This will be true if the user is using new API. It is only valid for the first API created for the app. It will be set to false if the user has data stored on the server and the data hasn't been migrated to new API.
Google Cloud endpoints has version management included so ony other API upgrade will be performed automatically in the Endpoints API.
If set to false it also means that the user will be informaed about data migration and will be transformed to new structure on demand.
Use of old data is not possible with the new API thought but this step is required to migrate the data since the user has `appId` parameter stored locally in the browser that will idenify user data.
New API uses Google's user id that can't be changed by the user (unlike email) and will unambiguously identify app user.
ResponseError:
type: AppResponse
description: |
Representation of the response for errored request.
properties:
error:
type: boolean
default: true
required: true
description: A flag set to response indicating that this is error message.
code:
type: number
required: true
description: Error code ID.
message?:
type: string
description: Optional message explaining the error.
RequestListResponse:
displayName: OK list response
description: The response when the server resulted with the list of requests (or empty list if the user do not have saved responses).
schema: RequestListSchema
RequestResponse:
displayName: OK request data response.
description: A response representing single saved request
schema: RequestSchema
HarResponse:
displayName: OK HAR response
description: A response with HAR object
schema: HarSchema
PutResponse:
type: AppResponse
displayName: OK insert response
description: |
A response for saved request put request.
This is different from any other put resposnes due to minimize network usage and limit number of bytes transfered by the call. Other fields are known to the app anyway.
This response will contain any other auto-generated values that were not present to the original request.
For example if `created` field wans't available with the request the server create new value at the moment of insertion to the datastore. This value will be returned by the request. It will not if it was previously in the request.
properties:
kind:
type: string
required: true
default: ARC#request
key:
type: string
required: true
description: AppEnding database key
PermissionRequestResponse:
displayName: OK permission
description: A response with granted permission or request with the permission to grant.
schema: PermissionSchema
PermissionListResponse:
displayName: OK response
description: OK response for permission list request
schema: PermissionListSchema
ProjectListResponse:
displayName: OK response
description: OK response for projects list request
schema: ProjectListSchema
ProjectRequestResponse:
displayName: OK response
description: OK response for project data request
schema: ProjectSchema
securitySchemes:
oauth_2_0: !include security-schemes/oauth_2_0.raml
securedBy: [ oauth_2_0: {scopes: [PROFILE, EMAIL]}]
traits:
paged: !include traits/paged.raml
projected: !include traits/projected.raml
secured: !include traits/secured.raml
/session:
description: An information about current user session.
is: [secured]
get:
responses:
200:
body:
application/json:
type: SessionState
/request:
description: |
An endpoint manipulate request objects in the datastore.
Request object have 0 to 1 related project object and a least 0 HAR objects.
It's not however required for the RequestObject to contain a HAR object. HAR are history of responses to one particular endpoint. RequestObject consist with the edpoint definition itself.
get:
description: |
Reads a list of requests available to the user.
This may include requests shared with the user by other users. The information about sharing level is available in permission field.
is: [paged, projected, secured]
responses:
200:
body:
application/json:
type: RequestListResponse
put:
description: |
Stores a new RequestObject in the datastore.
This enpoint do not require to put an HAR object in the same request.
body:
application/json:
schema: RequestSchema
responses:
200:
body:
application/json:
type: PutResponse
401:
body:
application/json:
type: ResponseError
description: The user is not authorized
/{requestId}:
description: |
Endpoint represent a data related to the stored request.
By default this endpoint will return a RequestObject with all HARs associated with it. Use projection without 'har' property included to retreive only the main definition of the request (body, method, url, payload) without requests history.
get:
description: Retreives single saved request definition.
is: [projected, secured]
responses:
200:
body:
application/json:
type: RequestResponse
401:
body:
application/json:
type: ResponseError
description: The user is not authorized
delete:
description: Removes user endpoint.
responses:
204:
description: The data has been deleted. No response body required.
post:
description: Updates user endpoint. The request must contain RequestObject properties. Only those available in the request will be changed.
body:
application/json:
type: RequestSchema
responses:
200:
body:
application/json:
type: PutResponse
/har:
description: Endpoint for manipulate HAR data associated with the saved request object.
get:
description: Retreives a list of HAR objects related to the request
is: [paged, projected, secured]
responses:
200:
body:
application/json:
type: HarResponse
delete:
description: Deletes all HAR data for selected endpoint
responses:
204:
description: The data has been deleted. No response body required.
/{harId}:
post:
description: Updates a HAR data.
body:
application/json:
type: HarSchema
responses:
200:
body:
application/json:
type: HarResponse
delete:
is: [secured]
description: Deletes particular HAR object definition.
responses:
204:
description: The data has been deleted. No response body required.
get:
is: [secured, projected]
description: Gets data for HAR object.
responses:
200:
body:
application/json:
type: HarResponse
/permissions:
description: |
An endpoint representing permission objects for the request.
To change a permission use /permission/{permissionId} endpoint
get:
description: Get a list of permissions associated with the request.
is: [paged, projected, secured]
responses:
200:
body:
type: PermissionListResponse
put:
is: [secured]
description: Add new permission to the request.
body:
application/json:
type: PutResponse
/project:
description: And endpoint to manipulate project related data.
get:
is: [paged, projected, secured]
description: Gets a list of projects that are accessible to the user.
responses:
200:
description: |
Returns a list of projects available to the user.
This method will result with project data only. It will not include permissions and requests filed until projection parameter contain request or permissions values.
body:
application/json:
type: ProjectListResponse
put:
is: [secured]
description: Add new project to the request.
body:
application/json:
type: ProjectRequestResponse
responses:
200:
description: Returns a list of projects available to the user.
body:
application/json:
type: PutResponse
/{projectId}:
get:
is: [secured, projected]
responses:
200:
body:
application/json:
type: ProjectRequestResponse
delete:
is: [secured]
description: |
Removes project frm the datastore.
responses:
204:
description: The data has been deleted. No response body required.
post:
is: [secured]
description: |
Change project.
Only name is allowed to change.
body:
application/json:
type: ProjectRequestResponse
responses:
200:
body:
application/json:
type: ProjectRequestResponse
/permissions:
description: |
An endpoint representing permission objects for the project.
Permissions granted on a request level override permissions on project level.
For example when the user has write access to the project but a request associated with the project has been share with the same user on "read" level finally user will have only "read" permission for the RequestObject.
To change a permission use /permission/{permissionId} endpoint
get:
description: Returns a list of permissions associated with the project.
is: [paged, projected, secured]
responses:
200:
body:
type: PermissionListResponse
put:
is: [secured]
description: Add new permission to the project.
body:
application/json:
type: PutResponse
/permission:
description: |
An endpoint to manipulate permissions.
Permissions are attached to an object internally and there's no need to point the connection using this endpoinds.
To create a permission use /{object}/permission endpoint for particular object.
/{permissionId}:
get:
description: Returns a permission definition.
is: [secured, projected]
responses:
200:
body:
application/json:
type: PermissionRequestResponse
delete:
is: [secured]
description: |
Removes granted permission.
It is possible to remove "owner" type permission only if another owner is in the list for particular object. Otherwise error will be returned.
Only an owner can change a permission to an object.
responses:
204:
description: The data has been deleted. No response body required.
400:
displayName: Bad Request
body:
application/json:
type: ResponseError
description: |
Returned when trying to remove permission of an object thet the user is not an owner or when an owner will try to remove his permission without setting a new owner.
post:
is: [secured]
description: |
Change a permission level.
Only "type" is allowed to change. It is possible to degrade "owner" to lower level only if other owner is in permission list.
body:
application/json:
type: PermissionSchema
responses:
200:
body:
application/json:
type: PermissionRequestResponse
400:
displayName: Bad Request
body:
application/json:
type: ResponseError
description: |
Returned when a user who is trying to change a permission is not an owner.
Also when an owner is trying to reduce his permission without promoting another user to be an owner.