-
Notifications
You must be signed in to change notification settings - Fork 0
/
GoREST API Swagger.json
477 lines (477 loc) · 16.5 KB
/
GoREST API Swagger.json
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
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
{
"openapi": "3.0.0",
"info": {
"title": "GoREST API Documentation",
"description": "## Introduction\n The **GoREST** API provides a free sandbox environment for performing REST API and GraphQL testing for prototyping. Registerd users provide fake user data, but the responses are real.\n ## Who is the GoREST API for?\n The audience for the [GoREST API]([http://gorest.co.in) is developers who need an easy way to test REST API and GraphQL endpoints.\n ## Authorization (Authentication)\n Users are required to create an account.\n A Token Bearer is not required to `GET` all general user information, but all other specific requests require a Token Bearer.\n ## Base URL\n [GoREST API]([http://gorest.co.in)\n ## Support\n If you encounter any errors while using the API, please use the Help button at the top of the main screen to read our knowledge base. If your question has not been answered, feel free to post a new question. We’ll do our best to resolve the issue as soon as possible. Please keep in mind that we are located in the India Standard Time Zone (IST).\n If you would like to contact us for any other reason, please use our contact form on the bottom of the main page. [http://gorest.co.in](www.gorest.co.in)\n ## Users Endpoint\n The **GoREST API** provides user profiles with user id, name, email, gender and status. You can perform CRUD operations on all users.\n\n\nhttp://gorest.co.in/public/v2/users\n\nThe following request are allowed for the Users Endpoint:\n\n**`GET`, `POST`, `PUT`, `PATCH`, `DELETE`**\n\n| **Parameter Name** | **Data Type** | **Description** |\n | --- | --- | --- |\n | id | integer | Required. The id is generated automatically when a user is created. The id is required for `PUT` and `DELETE` methods. <br>**Note:** You must use id for the `GET` method when requesting the user details with specific user id. |\n | name | string | Required. Used for creating a new user. The name is required for `POST`, `PUT` and `PATCH`. |\n | email | string | Required. The email is used for creating a new user. The email is required for `POST`, `PUT` and `PATCH`. |\n | status | string | Required. The status is used for creating a new user. The status is required for `POST`, `PUT` and `PATCH`. Available options include: active or inactive. |\n | gender | string | Required. The gender is used for creating a new user. The gender is required for `POST`. The available genders include: male or female. |\n\n\n## Posts Endpoint\n The **GoREST API** provides posts with post id, user_id, title and body. You can perform CRUD operations on all posts.\n\nhttp://gorest.co.in/public/v2/posts\n\nThe following request are allowed for the Posts Endpoint:\n\n**`GET`, `POST`, `PUT`, `PATCH`, `DELETE`**\n\n| **Parameter Name** | **Data Type** | **Description** |\n | --- | --- | --- |\n | id | integer | Required. The id is generated automatically when a message is created. The id is required for `PUT`, `PATCH` and `DELETE` methods. <br>**Note:** You must use id for the `GET` method when requesting post details with specific id. |\n | user_id | integer | Required. The user_id is required for `POST`, `PUT`, `PATCH` and `DELETE` . |\n | title | string | Required. The title is required for `POST`, `PUT`, `PATCH` and `DELETE`. |\n | body | string | Required. The body is required for `POST`, `PUT`, `PATCH` and `DELETE`. |\n\n## HTTP and Error Codes\n\nThe **GoRest API** returns HTTP status and error code messages.\n\n| **HTTP Code** | **Message** | **Description** |\n | --- | --- | --- |\n | 200 | OK | The request was successful. |\n | 201 | OK | A resource was successfully created in response to a `POST` request. The Location header contains the URL pointing to the newly created resource. |\n | 204 | OK | The request was handled successfully and the response contains no body content (like a `DELETE` request). |\n | 304 | OK | The resource was not modified. You can use the cached version. |\n | 400 | Bad Request | The request was invalid or missing a required parameter. |\n | 401 | Not Found | Authentication failed. |\n | 403 | Not Found | The authenticated user is not allowed to access the specified API endpoint. |\n | 404 | Not Found | The requested resource was not found. |\n | 405 | Not Found | Method not allowed. Please check the Allow header for the allowed HTTP methods. |\n | 415 | Not Found | Unsupported media type. The requested content type or version number is invalid. |\n | 422 | Not Found | Data validation failed (in response to a `POST` request, for example). Please check the response body for detailed error messages. |\n | 429 | Not Found | Too many requests. The request was rejected due to rate limiting. |\n | 500 | Internal Server Error | An error occurred on the server. |\n",
"termsOfService": "https://gorest.co.in/privacy-policy",
"contact": {
"email": "ldadams42@gmail.com"
},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "1.0.11"
},
"servers": [
{
"url": "https://virtserver.swaggerhub.com/B24979/APIDocumention/1.0.0",
"description": "Find out more about the SwaggerHub virtual server."
},
{
"url": "https://gorest.co.in/public/v2",
"description": "Find out more about the GoRest API."
}
],
"security": [
{
"bearerAuth": []
}
],
"tags": [
{
"name": "Users",
"description": "This collection has all the CRUD operations to create, edit, list and delete the users."
},
{
"name": "Posts",
"description": "This collection has all the CRUD operations to create, edit, list and delete the posts posted by the users."
}
],
"paths": {
"/posts{id}": {
"put": {
"tags": [
"Posts"
],
"summary": "Put request to update a post",
"description": "Use this method to update a post",
"operationId": "UpdatePost",
"parameters": [
{
"name": "id",
"in": "path",
"description": "id of the post",
"required": true,
"style": "simple",
"explode": true,
"schema": {
"type": "integer"
}
},
{
"name": "user_id",
"in": "query",
"description": "id of the user",
"required": true,
"style": "form",
"explode": true,
"schema": {
"type": "integer"
}
},
{
"name": "title",
"in": "query",
"description": "title of post",
"required": true,
"style": "form",
"explode": true,
"schema": {
"type": "string"
}
},
{
"name": "body",
"in": "query",
"description": "body of post",
"required": true,
"style": "form",
"explode": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
}
}
},
"responses": {
"200": {
"description": "Successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
}
}
},
"400": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
}
}
}
}
},
"delete": {
"tags": [
"Posts"
],
"summary": "Delete request to delete a post",
"description": "Use this method to delete a post",
"operationId": "DeletePost",
"parameters": [
{
"name": "id",
"in": "path",
"description": "id of the post",
"required": true,
"style": "simple",
"explode": true,
"schema": {
"type": "integer"
}
},
{
"name": "user_id",
"in": "query",
"description": "id of the user",
"required": true,
"style": "form",
"explode": true,
"schema": {
"type": "integer"
}
},
{
"name": "title",
"in": "query",
"description": "title of post",
"required": true,
"style": "form",
"explode": true,
"schema": {
"type": "string"
}
},
{
"name": "body",
"in": "query",
"description": "body of post",
"required": true,
"style": "form",
"explode": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
}
}
},
"400": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
}
}
}
}
}
},
"/posts/{user_id}": {
"put": {
"tags": [
"Posts"
],
"summary": "Put request to update a specific post by user id",
"description": "Use this method to update a specific post by user id",
"operationId": "UpdatePostUserId",
"parameters": [
{
"name": "user_id",
"in": "path",
"description": "The user_id needed to update a post",
"required": true,
"style": "simple",
"explode": false,
"schema": {
"type": "integer"
}
},
{
"name": "id",
"in": "query",
"description": "id of post",
"required": true,
"style": "form",
"explode": true,
"schema": {
"type": "integer"
}
},
{
"name": "title",
"in": "query",
"description": "title of post",
"required": true,
"style": "form",
"explode": true,
"schema": {
"type": "string"
}
},
{
"name": "body",
"in": "query",
"description": "body of post",
"required": true,
"style": "form",
"explode": true,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
}
}
},
"responses": {
"200": {
"description": "Successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
}
}
},
"400": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
}
}
}
}
},
"delete": {
"tags": [
"Posts"
],
"summary": "Delete request to delete a specific post by user id",
"description": "Use this method to delete a specific post by user id",
"operationId": "DeletePostUserId",
"parameters": [
{
"name": "user_id",
"in": "path",
"description": "User id needed to delete post",
"required": true,
"style": "simple",
"explode": false,
"schema": {
"type": "integer"
}
},
{
"name": "id",
"in": "query",
"description": "id of post",
"required": true,
"style": "form",
"explode": true,
"schema": {
"type": "integer"
}
},
{
"name": "title",
"in": "query",
"description": "title of post",
"required": true,
"style": "form",
"explode": true,
"schema": {
"type": "string"
}
},
{
"name": "body",
"in": "query",
"description": "body of post",
"required": true,
"style": "form",
"explode": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "Successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
}
}
},
"400": {
"description": "Not found",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"Posts": {
"required": [
"body",
"id",
"title",
"user_id"
],
"type": "object",
"properties": {
"id": {
"type": "integer",
"format": "int64",
"example": 10
},
"user_id": {
"type": "integer",
"format": "int64",
"example": 10
},
"title": {
"type": "string",
"example": "theTitle"
},
"body": {
"type": "string",
"example": "theBody"
}
}
}
},
"requestBodies": {
"posts": {
"description": "An object containing Posts",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
},
"application/xml": {
"schema": {
"$ref": "#/components/schemas/Posts"
}
}
},
"required": true
}
},
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "JWT"
}
}
}
}