-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAddressManager.postman_collection.json
621 lines (621 loc) · 17.3 KB
/
AddressManager.postman_collection.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
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
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
{
"info": {
"_postman_id": "49db3543-d5fb-4247-84d7-ed1d0ff25997",
"name": "Address Manager",
"description": "Address Manager is a micro-service that stores and validates international address information.",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"item": [
{
"name": "Create Address",
"event": [
{
"listen": "test",
"script": {
"id": "d1dbaab9-24ef-46b5-b0d1-ebb2ea58bc7d",
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"Set `address` env var\", function () {",
" var json = pm.response.json();",
" ",
" pm.expect(json.id).to.not.eql(null);",
" pm.environment.set(\"address\", json.id);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"city\": \"Cupertino\",\n\t\"district\": \"California\",\n\t\"postalArea\": \"95014\",\n\t\"street\": {\n\t\t\"number\": 1,\n\t\t\"name\": \"Apple Park\",\n\t\t\"type\": \"Way\"\n\t}\n}"
},
"url": {
"raw": "http://localhost:8080/v1/addresses/",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"addresses",
""
]
},
"description": "Creates a new `Address` model.\n\nThe body of the request will be validated before it is saved to the database. If validation fails, a 400 (Bad Request) response will be returned and the model will not be saved.\n\n## Address\n\n| Key | Type | Description |\n| ---------------- | ------ | ------------------------------------------------------------ |\n| `buildingName` | String | The name of the building that is located at the address |\n| `type` | String | P.O. Box, apartment, building, floor, etc. |\n| `typeIdentifier` | String | The value for the type. P.O Box number, floor number, etc. |\n| `municipality` | String | Refines the city name, for example, the hamlet or villiage name. |\n| `city` | String | The city the address is in. |\n| `district` | String | The name of the state, province, government district, etc. |\n| `postalArea` | String | The zip code, postal code, etc. of the address. |\n| `country` | String | The country the address is in. |\n| `street` | Street | The street information for the address |\n\n## Street\n\n| Key | Type | Description |\n| -------------- | --------- | ------------------------------------------------------------ |\n| `number` | Int | The street number. |\n| `numberSuffix` | String | The street number's suffix, i.e. `A`, `B`, etc. |\n| `name` | String | The name of the street. |\n| `type` | String | The street's type, i.e. `Dr.`, `Street`, `Loop`, `Pkwy`, etc. |\n| direction | Direction | The compass point of the street, i.e. `N`, `E`, `S`, `W`, etc. |\n\n## Direction\n\n| Case | Description |\n| ---- | ----------- |\n| `N` | North |\n| `E` | East |\n| `S` | South |\n| `W` | West |\n| `NE` | North East |\n| `NW` | North West |\n| `SE` | South East |\n| `SW` | South West |\n\n"
},
"response": [
{
"name": "Create Address",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"city\": \"Cupertino\",\n\t\"district\": \"California\",\n\t\"postalArea\": \"95014\",\n\t\"buildingName\": \"Apple Campus\"\n}"
},
"url": {
"raw": "http://localhost:8080/v1/addresses/",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"addresses",
""
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "content-type",
"value": "application/json; charset=utf-8"
},
{
"key": "content-length",
"value": "120"
},
{
"key": "date",
"value": "Mon, 11 Mar 2019 19:45:57 GMT"
},
{
"key": "Connection",
"value": "keep-alive"
}
],
"cookie": [],
"body": "{\n \"district\": \"California\",\n \"id\": 1,\n \"buildingName\": \"Apple Campus\",\n \"postalArea\": \"95014\",\n \"city\": \"Cupertino\",\n \"street\": {\n \"id\": 1\n }\n}"
}
]
},
{
"name": "Get Address",
"event": [
{
"listen": "test",
"script": {
"id": "36b061d2-c46f-402d-a0d5-8ba3de27d390",
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"Address ID is equal to `address` var\", function () {",
" var json = pm.response.json();",
" var address = parseInt(pm.environment.get(\"address\"));",
" ",
" pm.expect(json.id).to.eql(address);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://localhost:8080/v1/addresses/{{address}}",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"addresses",
"{{address}}"
]
},
"description": "Gets the `Address` model data for a given ID."
},
"response": [
{
"name": "Get Address",
"originalRequest": {
"method": "GET",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://localhost:8080/v1/addresses/{{address}}",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"addresses",
"{{address}}"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "content-type",
"value": "application/json; charset=utf-8"
},
{
"key": "content-length",
"value": "120"
},
{
"key": "date",
"value": "Mon, 11 Mar 2019 19:46:12 GMT"
},
{
"key": "Connection",
"value": "keep-alive"
}
],
"cookie": [],
"body": "{\n \"district\": \"California\",\n \"id\": 1,\n \"buildingName\": \"Apple Campus\",\n \"postalArea\": \"95014\",\n \"city\": \"Cupertino\",\n \"street\": {\n \"id\": 1\n }\n}"
}
]
},
{
"name": "Updated Address",
"event": [
{
"listen": "test",
"script": {
"id": "a698dc01-04fa-4e6d-b886-690700f7a8a4",
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"Address ID is equal to `address` var\", function () {",
" var json = pm.response.json();",
" var address = parseInt(pm.environment.get(\"address\"));",
" ",
" pm.expect(json.id).to.eql(address);",
"});",
"",
"pm.test(\"Address.country is equal to 'United States'\", function () {",
" var json = pm.response.json();",
" pm.expect(json.country).to.eql(\"United States\");",
"});",
""
],
"type": "text/javascript"
}
}
],
"request": {
"method": "PATCH",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"country\": \"United States\"\n}"
},
"url": {
"raw": "http://localhost:8080/v1/addresses/{{address}}",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"addresses",
"{{address}}"
]
},
"description": "Updates the properties of an `Address` model.\n\nThe request body passed in acts as the data for updating the model. If a property has a value, the saved model's column will be updated to that value. This means that if you pass in `null`, the property will be set to that value. Properties that are not defined will be ignored.\n\nWhen the model is updated, the new data will be validated. If validation fails, the update will not be saved."
},
"response": [
{
"name": "Updated Address",
"originalRequest": {
"method": "PATCH",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"country\": \"United States\",\n\t\"street\": {\n\t\t\"name\": \"Infinite\",\n\t\t\"type\": \"Loop\"\n\t}\n}"
},
"url": {
"raw": "http://localhost:8080/v1/addresses/{{address}}",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"addresses",
"{{address}}"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "json",
"header": [
{
"key": "content-type",
"value": "application/json; charset=utf-8"
},
{
"key": "content-length",
"value": "178"
},
{
"key": "date",
"value": "Mon, 11 Mar 2019 19:46:30 GMT"
},
{
"key": "Connection",
"value": "keep-alive"
}
],
"cookie": [],
"body": "{\n \"district\": \"California\",\n \"city\": \"Cupertino\",\n \"country\": \"United States\",\n \"id\": 1,\n \"street\": {\n \"id\": 1,\n \"name\": \"Infinite\",\n \"type\": \"Loop\"\n },\n \"buildingName\": \"Apple Campus\",\n \"postalArea\": \"95014\"\n}"
}
]
},
{
"name": "Delete Addresses",
"event": [
{
"listen": "test",
"script": {
"id": "3e82f537-71a3-496f-8b95-3a3c73b37c88",
"exec": [
"pm.test(\"Status code is 204\", function () {",
" pm.response.to.have.status(204);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "DELETE",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://localhost:8080/v1/addresses/{{address}}",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"addresses",
"{{address}}"
]
},
"description": "Deletes an existing `Address` model by ID."
},
"response": [
{
"name": "Delete Addresses",
"originalRequest": {
"method": "DELETE",
"header": [],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "http://localhost:8080/v1/addresses/{{address}}",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"addresses",
"{{address}}"
]
}
},
"status": "No Content",
"code": 204,
"_postman_previewlanguage": "plain",
"header": [
{
"key": "date",
"value": "Mon, 11 Mar 2019 19:46:50 GMT"
},
{
"key": "Connection",
"value": "keep-alive"
}
],
"cookie": [],
"body": null
}
]
},
{
"name": "Validate Address",
"event": [
{
"listen": "test",
"script": {
"id": "d4d6ab29-8b80-4229-8f21-eea09eb94d01",
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"city\": \"Cupertino\",\n\t\"district\": \"California\",\n\t\"postalArea\": \"95014\",\n\t\"street\": {\n\t\t\"number\": 1,\n\t\t\"name\": \"Apple Park\",\n\t\t\"type\": \"Way\"\n\t}\n}"
},
"url": {
"raw": "http://localhost:8080/v1/addresses/validate",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"addresses",
"validate"
]
},
"description": "Validates the address data without sotring it. A successfull validation will return a 200 (OK) response without a body."
},
"response": [
{
"name": "Validate Address",
"originalRequest": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"buildingName\": \"Apple Campus\",\n\t\"city\": \"Cupertino\",\n\t\"district\": \"California\",\n\t\"postalArea\": \"95014\"\n}"
},
"url": {
"raw": "http://localhost:8084/v1/addresses/validate",
"protocol": "http",
"host": [
"localhost"
],
"port": "8084",
"path": [
"v1",
"addresses",
"validate"
]
}
},
"status": "OK",
"code": 200,
"_postman_previewlanguage": "plain",
"header": [
{
"key": "content-length",
"value": "0"
},
{
"key": "date",
"value": "Tue, 12 Mar 2019 20:55:20 GMT"
},
{
"key": "Connection",
"value": "keep-alive"
}
],
"cookie": [],
"body": null
}
]
},
{
"name": "Parse Address",
"event": [
{
"listen": "test",
"script": {
"id": "ad3030b6-1906-4ec0-8341-4bd1bd604497",
"exec": [
"pm.test(\"Status code is 200\", function () {",
" pm.response.to.have.status(200);",
"});",
"",
"pm.test(\"Address country is 'United States'\", function () {",
" var json = pm.response.json();",
" pm.expect(json.country).to.eql('United States');",
"});",
"",
"pm.test(\"Address postalArea is '10012'\", function () {",
" var json = pm.response.json();",
" pm.expect(json.postalArea).to.eql('10012');",
"});",
"",
"pm.test(\"Address district is 'NY'\", function () {",
" var json = pm.response.json();",
" pm.expect(json.district).to.eql('NY');",
"});",
"",
"pm.test(\"Address city is 'New York'\", function () {",
" var json = pm.response.json();",
" pm.expect(json.city).to.eql('New York');",
"});",
"",
"pm.test(\"Address street number is 39\", function () {",
" var json = pm.response.json();",
" pm.expect(json.street.number).to.eql(39);",
"});",
"",
"pm.test(\"Address street number suffix is '1/2'\", function () {",
" var json = pm.response.json();",
" pm.expect(json.street.numberSuffix).to.eql('1/2');",
"});",
"",
"pm.test(\"Address street name is 'Washington'\", function () {",
" var json = pm.response.json();",
" pm.expect(json.street.name).to.eql('Washington');",
"});",
"",
"pm.test(\"Address street type is 'Sq'\", function () {",
" var json = pm.response.json();",
" pm.expect(json.street.type).to.eql('Sq');",
"});",
"",
"pm.test(\"Address street direction is 'S'\", function () {",
" var json = pm.response.json();",
" pm.expect(json.street.direction).to.eql('S');",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"value": "application/json",
"type": "text"
}
],
"body": {
"mode": "raw",
"raw": "{\n\t\"country\": \"United States\",\n\t\"data\": \"39 1/2 Washington Sq S, New York, NY 10012\"\n}"
},
"url": {
"raw": "http://localhost:8080/v1/addresses/parse",
"protocol": "http",
"host": [
"localhost"
],
"port": "8080",
"path": [
"v1",
"addresses",
"parse"
]
},
"description": "Parses a freeform address into an object containing individual address components."
},
"response": []
}
],
"event": [
{
"listen": "prerequest",
"script": {
"id": "676cbcfc-c5d9-4011-8d48-078d75582fa5",
"type": "text/javascript",
"exec": [
""
]
}
},
{
"listen": "test",
"script": {
"id": "0914da2e-dab5-4875-88f0-b0a44a2d07a3",
"type": "text/javascript",
"exec": [
""
]
}
}
]
}