-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPostman Echo.postman_collection.json
More file actions
567 lines (567 loc) · 20.2 KB
/
Postman Echo.postman_collection.json
File metadata and controls
567 lines (567 loc) · 20.2 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
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
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
{
"info": {
"_postman_id": "ced742cd-bfa8-40ca-bae2-f74317062cb2",
"name": "Postman Echo",
"description": "Postman Echo is a service you can use to test your REST clients and make sample API calls. It provides endpoints for `GET`, `POST`, `PUT`, various auth mechanisms and other utility endpoints.\n\nThe documentation for the endpoints as well as example responses can be found at [https://postman-echo.com](https://postman-echo.com/?source=echo-collection-app-onboarding)",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
"_exporter_id": "7750291",
"_collection_link": "https://k27test.postman.co/workspace/CTA---Chile~d2f9dc3e-d3e5-4a57-8fd5-3f85cacec102/collection/7750291-ced742cd-bfa8-40ca-bae2-f74317062cb2?action=share&source=collection_link&creator=7750291"
},
"item": [
{
"name": "Request Methods",
"item": [
{
"name": "GET Request",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"response is ok\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"response body has json with request queries\", function () {",
" pm.response.to.have.jsonBody('args.foo1', 'bar1')",
" .and.have.jsonBody('args.foo2', 'bar2');",
"});"
],
"type": "text/javascript",
"packages": {}
}
}
],
"protocolProfileBehavior": {
"disabledSystemHeaders": {
"connection": true,
"accept-encoding": true
}
},
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "https://postman-echo.com/get?foo1=bar1&foo2=bar2",
"protocol": "https",
"host": [
"postman-echo",
"com"
],
"path": [
"get"
],
"query": [
{
"key": "foo1",
"value": "bar1"
},
{
"key": "foo2",
"value": "bar2"
}
]
},
"description": "The HTTP `GET` request method is meant to retrieve data from a server. The data \nis identified by a unique URI (Uniform Resource Identifier).\n\nA `GET` request can pass parameters to the server using \"Query String \nParameters\". For example, in the following request,\n\n> [http://example.com/hi/there?hand=wave](http://example.com/hi/there?hand=wave) \n \n\nThe parameter \"hand\" has the value \"wave\".\n\nThis endpoint echoes the HTTP headers, request parameters and the complete \nURI requested."
},
"response": [
{
"name": "GET Request Woops",
"originalRequest": {
"method": "GET",
"header": [],
"url": {
"raw": "https://postman-echo.com/get?foo1=bar1&foo2=bar2",
"protocol": "https",
"host": [
"postman-echo",
"com"
],
"path": [
"get"
],
"query": [
{
"key": "foo1",
"value": "bar1"
},
{
"key": "foo2",
"value": "bar2"
}
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Content-Encoding",
"value": "gzip"
},
{
"key": "Content-Type",
"value": "application/json; charset=utf-8"
},
{
"key": "Date",
"value": "Tue, 11 Jun 2019 10:43:13 GMT"
},
{
"key": "ETag",
"value": "W/\"161-aLhNcsGArlgLSKbxPqfBW3viHPI\""
},
{
"key": "Server",
"value": "nginx"
},
{
"key": "set-cookie",
"value": "sails.sid=s%3AGz-wblZgXE8FCDq7aJpx_tUgZUcG3Nsw.LdNEN8L0C7nGWkvGLwvdw6R2s6Syjr%2FzkvyevA8qR0c; Path=/; HttpOnly"
},
{
"key": "Vary",
"value": "Accept-Encoding"
},
{
"key": "Content-Length",
"value": "249"
},
{
"key": "Connection",
"value": "keep-alive"
}
],
"cookie": [],
"body": "{\n \"args\": {\n \"foo1\": \"bar1\",\n \"foo2\": \"bar2\"\n },\n \"headers\": {\n \"x-forwarded-proto\": \"https\",\n \"host\": \"postman-echo.com\",\n \"accept\": \"*/*\",\n \"accept-encoding\": \"gzip, deflate\",\n \"cache-control\": \"no-cache\",\n \"postman-token\": \"5c27cd7d-6b16-4e5a-a0ef-191c9a3a275f\",\n \"user-agent\": \"PostmanRuntime/7.6.1\",\n \"x-forwarded-port\": \"443\"\n },\n \"url\": \"https://postman-echo.com/get?foo1=bar1&foo2=bar2\"\n}"
}
]
},
{
"name": "POST Raw Text",
"event": [
{
"listen": "test",
"script": {
"exec": [
"pm.test(\"response is ok\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"response body has json with request body\", function () {",
" pm.response.to.have.jsonBody('data', ",
" 'This is expected to be sent back as part of response body.');",
"});",
"",
"pm.test(\"testing method\", function () {",
" const requestBody = {",
" \"test\": \"value\"",
" };",
"",
" pm.sendRequest({",
" url: pm.request.url,",
" method: pm.request.method,",
" headers: pm.request.headers,",
" body: {",
" mode: 'raw',",
" raw: JSON.stringify(requestBody)",
" }",
" }, function (err, res) {",
" console.log('rahul', res.json());",
" })",
"})"
],
"type": "text/javascript",
"packages": {}
}
},
{
"listen": "prerequest",
"script": {
"exec": [
""
],
"type": "text/javascript",
"packages": {}
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "raw",
"raw": "{\n \"test\": \"value\"\n}"
},
"url": {
"raw": "https://postman-echo.com/post",
"protocol": "https",
"host": [
"postman-echo",
"com"
],
"path": [
"post"
]
},
"description": "The HTTP `POST` request method is meant to transfer data to a server \n(and elicit a response). What data is returned depends on the implementation\nof the server.\n\nA `POST` request can pass parameters to the server using \"Query String \nParameters\", as well as the Request Body. For example, in the following request,\n\n> POST /hi/there?hand=wave\n>\n> <request-body>\n\nThe parameter \"hand\" has the value \"wave\". The request body can be in multiple\nformats. These formats are defined by the MIME type of the request. The MIME \nType can be set using the ``Content-Type`` HTTP header. The most commonly used \nMIME types are:\n\n* `multipart/form-data`\n* `application/x-www-form-urlencoded`\n* `application/json`\n\nThis endpoint echoes the HTTP headers, request parameters, the contents of\nthe request body and the complete URI requested."
},
"response": []
},
{
"name": "POST Form Data",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test(\"response is ok\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"response body has json with form data\", function () {",
" pm.response.to.have.jsonBody('form.foo1', 'bar1')",
" .and.have.jsonBody('form.foo2', 'bar2');",
"});"
]
}
}
],
"request": {
"method": "POST",
"header": [],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "foo1",
"value": "bar1",
"type": "text"
},
{
"key": "foo2",
"value": "bar2",
"type": "text"
}
]
},
"url": {
"raw": "https://postman-echo.com/post",
"protocol": "https",
"host": [
"postman-echo",
"com"
],
"path": [
"post"
]
},
"description": "The HTTP `POST` request method is meant to transfer data to a server \n(and elicit a response). What data is returned depends on the implementation\nof the server.\n\nA `POST` request can pass parameters to the server using \"Query String \nParameters\", as well as the Request Body. For example, in the following request,\n\n> POST /hi/there?hand=wave\n>\n> <request-body>\n\nThe parameter \"hand\" has the value \"wave\". The request body can be in multiple\nformats. These formats are defined by the MIME type of the request. The MIME \nType can be set using the ``Content-Type`` HTTP header. The most commonly used \nMIME types are:\n\n* `multipart/form-data`\n* `application/x-www-form-urlencoded`\n* `application/json`\n\nThis endpoint echoes the HTTP headers, request parameters, the contents of\nthe request body and the complete URI requested when data is sent as a form parameter."
},
"response": [
{
"name": "POST Form Data",
"originalRequest": {
"method": "POST",
"header": [],
"body": {
"mode": "urlencoded",
"urlencoded": [
{
"key": "foo1",
"value": "bar1",
"type": "text"
},
{
"key": "foo2",
"value": "bar2",
"type": "text"
}
]
},
"url": {
"raw": "https://postman-echo.com/post",
"protocol": "https",
"host": [
"postman-echo",
"com"
],
"path": [
"post"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "Date",
"value": "Mon, 06 Feb 2023 09:32:50 GMT"
},
{
"key": "Content-Type",
"value": "application/json; charset=utf-8"
},
{
"key": "Content-Length",
"value": "541"
},
{
"key": "Connection",
"value": "keep-alive"
},
{
"key": "ETag",
"value": "W/\"21d-xfFK76757VvHgzzscqtMAqpVMD8\""
},
{
"key": "Vary",
"value": "Accept-Encoding"
},
{
"key": "set-cookie",
"value": "sails.sid=s%3A2_ZQ2_JOXHPJpdYeKx8H9Vl7cWGbHQRb.RYNjk0CqTPQJ%2FkAXEcFxGeHIJrNStXm9Nxi8ib0wcDI; Path=/; HttpOnly"
}
],
"cookie": [],
"body": "{\n \"args\": {},\n \"data\": \"\",\n \"files\": {},\n \"form\": {\n \"foo1\": \"bar1\",\n \"foo2\": \"bar2\"\n },\n \"headers\": {\n \"x-forwarded-proto\": \"https\",\n \"x-forwarded-port\": \"443\",\n \"host\": \"postman-echo.com\",\n \"x-amzn-trace-id\": \"Root=1-63e0c942-584c7dab4a1c52d34d581b03\",\n \"content-length\": \"19\",\n \"user-agent\": \"PostmanRuntime/7.30.1\",\n \"accept\": \"*/*\",\n \"cache-control\": \"no-cache\",\n \"postman-token\": \"159c6495-8e5f-4ce0-bacd-ac399a86ec03\",\n \"accept-encoding\": \"gzip, deflate, br\",\n \"content-type\": \"application/x-www-form-urlencoded\"\n },\n \"json\": {\n \"foo1\": \"bar1\",\n \"foo2\": \"bar2\"\n },\n \"url\": \"https://postman-echo.com/post\"\n}"
}
]
},
{
"name": "PUT Request",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test(\"response is ok\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"response body has json with form data\", function () {",
" pm.response.to.have.jsonBody('data', ",
" 'This is expected to be sent back as part of response body.');",
"});"
]
}
}
],
"request": {
"method": "PUT",
"header": [],
"body": {
"mode": "raw",
"raw": "This is expected to be sent back as part of response body."
},
"url": {
"raw": "https://postman-echo.com/put",
"protocol": "https",
"host": [
"postman-echo",
"com"
],
"path": [
"put"
]
},
"description": "The HTTP `PUT` request method is similar to HTTP `POST`. It too is meant to \ntransfer data to a server (and elicit a response). What data is returned depends on the implementation\nof the server.\n\nA `PUT` request can pass parameters to the server using \"Query String \nParameters\", as well as the Request Body. For example, in the following \nraw HTTP request,\n\n> PUT /hi/there?hand=wave\n>\n> <request-body>\n\n\n"
},
"response": []
},
{
"name": "PATCH Request",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test(\"response is ok\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"response body has json with form data\", function () {",
" pm.response.to.have.jsonBody('data', ",
" 'This is expected to be sent back as part of response body.');",
"});"
]
}
}
],
"request": {
"method": "PATCH",
"header": [],
"body": {
"mode": "raw",
"raw": "This is expected to be sent back as part of response body."
},
"url": {
"raw": "https://postman-echo.com/patch",
"protocol": "https",
"host": [
"postman-echo",
"com"
],
"path": [
"patch"
]
},
"description": "The HTTP `PATCH` method is used to update resources on a server. The exact\nuse of `PATCH` requests depends on the server in question. There are a number\nof server implementations which handle `PATCH` differently. Technically, \n`PATCH` supports both Query String parameters and a Request Body.\n\nThis endpoint accepts an HTTP `PATCH` request and provides debug information\nsuch as the HTTP headers, Query String arguments, and the Request Body."
},
"response": []
},
{
"name": "DELETE Request",
"event": [
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"pm.test(\"response is ok\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"response body has json with form data\", function () {",
" pm.response.to.have.jsonBody('data', ",
" 'This is expected to be sent back as part of response body.');",
"});"
]
}
}
],
"request": {
"method": "DELETE",
"header": [],
"body": {
"mode": "raw",
"raw": "This is expected to be sent back as part of response body."
},
"url": {
"raw": "https://postman-echo.com/delete",
"protocol": "https",
"host": [
"postman-echo",
"com"
],
"path": [
"delete"
]
},
"description": "The HTTP `DELETE` method is used to delete resources on a server. The exact\nuse of `DELETE` requests depends on the server implementation. In general, \n`DELETE` requests support both, Query String parameters as well as a Request \nBody.\n\nThis endpoint accepts an HTTP `DELETE` request and provides debug information\nsuch as the HTTP headers, Query String arguments, and the Request Body."
},
"response": []
}
],
"description": "HTTP has multiple request \"verbs\", such as `GET`, `PUT`, `POST`, `DELETE`, \n`PATCH`, `HEAD`, etc.\n\nAn HTTP Method (verb) defines how a request should be interpreted by a server. \nThe endpoints in this section demonstrate various HTTP Verbs. Postman supports \nall the HTTP Verbs, including some rarely used ones, such as `PROPFIND`, `UNLINK`, \netc.\n\nFor details about HTTP Verbs, refer to [RFC 2616](http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html#sec9)"
}
],
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"requests": {},
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"requests": {},
"exec": [
"// ================================\r",
"// Guardar URL de la request\r",
"// ================================\r",
"(function () {\r",
" try {\r",
" const rawUrl = pm.request && pm.request.url ? pm.request.url.toString() : '';\r",
" const MAX = 2000;\r",
" const recorte = rawUrl.length > MAX ? rawUrl.slice(0, MAX) + '...[TRUNCADO]' : rawUrl;\r",
" const base64 = btoa(unescape(encodeURIComponent(recorte)));\r",
" const reqId = (pm.request && pm.request.id) ? pm.request.id : 'undefined';\r",
" const iter = pm.info && typeof pm.info.iteration !== 'undefined' ? pm.info.iteration : 0;\r",
" const testName = `__URL__${reqId}__${iter}__${base64}`;\r",
"\r",
" pm.test(testName, function () {\r",
" pm.expect(true).to.be.true;\r",
" });\r",
" } catch (e) {\r",
" console.log('Error creando test __URL__', e);\r",
" }\r",
"})();\r",
"\r",
"// ================================\r",
"// Guardar body de la request\r",
"// ================================\r",
"(function () {\r",
" try {\r",
" let rawBody = '';\r",
"\r",
" if (pm.request.body) {\r",
" switch (pm.request.body.mode) {\r",
" case 'raw':\r",
" rawBody = pm.request.body.raw;\r",
" break;\r",
" case 'urlencoded':\r",
" rawBody = pm.request.body.urlencoded\r",
" .map(item => `${item.key}=${item.value}`)\r",
" .join('&');\r",
" break;\r",
" case 'formdata':\r",
" rawBody = pm.request.body.formdata\r",
" .map(item => `${item.key}=${item.value || ''}`)\r",
" .join('&');\r",
" break;\r",
" default:\r",
" rawBody = '';\r",
" }\r",
" }\r",
"\r",
" const MAX = 4000;\r",
" const recorte = rawBody.length > MAX ? rawBody.slice(0, MAX) + '...[TRUNCADO]' : rawBody;\r",
" const base64 = btoa(unescape(encodeURIComponent(recorte)));\r",
" const reqId = (pm.request && pm.request.id) ? pm.request.id : 'undefined';\r",
" const iter = pm.info && typeof pm.info.iteration !== 'undefined' ? pm.info.iteration : 0;\r",
" const testName = `__REQBODY__${reqId}__${iter}__${base64}`;\r",
"\r",
" pm.test(testName, function () {\r",
" pm.expect(true).to.be.true;\r",
" });\r",
" } catch (e) {\r",
" console.log('Error creando test __REQBODY__', e);\r",
" }\r",
"})();\r",
"\r",
"// ================================\r",
"// Guardar body de la response\r",
"// ================================\r",
"(function () {\r",
" try {\r",
" const raw = pm.response.text() || '';\r",
" const MAX = 4000;\r",
" const recorte = raw.length > MAX ? raw.slice(0, MAX) + '...[TRUNCADO]' : raw;\r",
" const base64 = btoa(unescape(encodeURIComponent(recorte)));\r",
" const testName = `__BODY__${pm.request.id}__${pm.info.iteration}__${base64}`;\r",
"\r",
" pm.test(testName, function () {\r",
" pm.expect(true).to.be.true;\r",
" });\r",
" } catch (e) {\r",
" console.log('Error creando test __BODY__', e);\r",
" }\r",
"})();\r",
""
]
}
}
]
}