-
Notifications
You must be signed in to change notification settings - Fork 132
/
Copy pathVTEX - Pick and Pack Order Changes API.json
795 lines (794 loc) · 38.3 KB
/
VTEX - Pick and Pack Order Changes API.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
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
{
"openapi": "3.0.0",
"info": {
"title": "Pick and Pack Order Changes API",
"description": "The Pick and Pack Order Changes API manages order modifications in a Pick and Pack order. This API supports actions like updating deadlines, adding items, modifying quantities, rejecting or replacing items, and updating item details.\r\n\r\n>ℹ️ This API is currently in beta and subject to changes. Use it with caution in production environments.\r\n\r\n## Index\r\n\r\n- `PUT` [Update order deadline](https://developers.vtex.com/docs/api-reference/pick-and-pack-order-changes-api#put-/orders/-orderId-/deadline)\r\n- `POST` [Update items of the order](https://developers.vtex.com/docs/api-reference/pick-and-pack-order-changes-api#post-/order/changes)",
"contact": {},
"version": "1.0"
},
"servers": [
{
"url": "https://{accountName}.{environment}.com.br/vtex_pickandpack",
"description": "VTEX server URL.",
"variables": {
"accountName": {
"description": "Name of the VTEX account. Used as part of the URL.",
"default": "apiexamples"
},
"environment": {
"description": "Environment to use. Used as part of the URL.",
"enum": ["vtexcommercestable"],
"default": "vtexcommercestable"
}
}
}
],
"paths": {
"/orders/{orderId}/deadline": {
"put": {
"summary": "Update order deadline",
"description": "Updates the deadline for an order. The `min` and `max` fields specify the deadline window, while the description provides additional information.\r\n\r\n>ℹ️ This endpoint is currently in beta and subject to changes. Use with caution in production environments.\r\n\r\n## Permissions\r\n\r\nAny user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint:\r\n\r\n| **Product** | **Category** | **Resource** |\r\n| --------------- | ----------------- | ----------------- |\r\n| OMS | OMS access | **View order** |\r\n| OMS | OMS access | **Only show orders created by the user (via call center)** |\r\n| Catalog | Telesales | **Assisted Sales** |\r\n\r\nThere are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication).\r\n\r\n>\u2757 To prevent integrations from having excessive permissions, consider the [best practices for managing app keys](https://help.vtex.com/en/tutorial/best-practices-application-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations.",
"parameters": [
{
"$ref": "#/components/parameters/orderId"
},
{
"$ref": "#/components/parameters/Accept"
},
{
"$ref": "#/components/parameters/Content-Type"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateDeadlineRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/UpdateDeadlineResponse"
},
"example": {
"order": {
"currentDeadline": {
"max": "2024-12-24T23:03:02Z",
"min": "2024-12-23T23:03:02Z"
},
"deadlineChanges": [
{
"current": true,
"description": "Extend deadline due to delayed shipment",
"handled": true,
"max": "2024-12-24T23:03:02.000Z",
"min": "2024-12-23T23:03:02.000Z",
"oldDates": {
"max": "2024-12-04T17:20:48.088Z",
"min": "2024-12-04T17:20:48.088Z"
},
"updatedAt": "2024-12-03T17:35:59.786Z"
}
],
"orderId": "1481050515517-01"
},
"success": true
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"description": "Request error object with error information.",
"type": "object",
"properties": {
"code": {
"description": "Error code.",
"type": "string"
},
"message": {
"description": "Error message.",
"type": "string"
}
}
},
"success": {
"description": "Condition if the request was successful.",
"type": "boolean"
}
}
},
"example": {
"error": {
"code": "400",
"message": "New dates must be greater than the current dates"
},
"success": false
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"description": "Authentication failed due to missing, invalid, or expired credentials. Ensure the `X-VTEX-API-AppKey` and `X-VTEX-API-AppToken` headers include valid values.",
"type": "string"
}
}
},
"example": {
"message": "Unauthorized"
}
}
}
}
},
"deprecated": false
}
},
"/order/changes": {
"post": {
"summary": "Update items of the order",
"description": "The endpoint supports actions like adding items, modifying quantities, rejecting or replacing items, and updating item details, adding notes and suggest product replacements.\r\n\r\n>ℹ️ This endpoint is currently in beta and subject to changes. Use with caution in production environments.\r\n\r\n>⚠️ Before using this endpoint, you must make a request with the [Cart simulation](https://developers.vtex.com/docs/api-reference/checkout-api#post-/api/checkout/pub/orderForms/simulation) endpoint to check inventory availability. For more information of how to simulate a cart, check the [Simulate a shopping cart](https://developers.vtex.com/docs/guides/simulate-a-shopping-cart) guide.\r\n\r\n## Permissions\r\n\r\nAny user or [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys) must have at least one of the appropriate [License Manager resources](https://help.vtex.com/en/tutorial/license-manager-resources--3q6ztrC8YynQf6rdc6euk3) to be able to successfully run this request. Otherwise they will receive a status code `403` error. These are the applicable resources for this endpoint:\r\n\r\n| **Product** | **Category** | **Resource** |\r\n| --------------- | ----------------- | ----------------- |\r\n| OMS | OMS access | **View order** |\r\n| OMS | OMS access | **Only show orders created by the user (via call center)** |\r\n| Catalog | Telesales | **Assisted Sales** |\r\n\r\nThere are no applicable [predefined roles](https://help.vtex.com/en/tutorial/predefined-roles--jGDurZKJHvHJS13LnO7Dy) for this resource list. You must [create a custom role](https://help.vtex.com/en/tutorial/roles--7HKK5Uau2H6wxE1rH5oRbc#creating-a-role) and add at least one of the resources above in order to use this endpoint. To learn more about machine authentication at VTEX, see [Authentication overview](https://developers.vtex.com/docs/guides/authentication).\r\n\r\n>\u2757 To prevent integrations from having excessive permissions, consider the [best practices for managing app keys](https://help.vtex.com/en/tutorial/best-practices-application-keys--7b6nD1VMHa49aI5brlOvJm) when assigning License Manager roles to integrations.",
"parameters": [
{
"$ref": "#/components/parameters/Accept"
},
{
"$ref": "#/components/parameters/Content-Type"
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"oneOf":[
{
"$ref": "#/components/schemas/AddItemRequest"
},
{
"$ref": "#/components/schemas/AddQuantityRequest"
},
{
"$ref": "#/components/schemas/ItemToAddRequest"
},
{
"$ref": "#/components/schemas/RejectItemRequest"
},
{
"$ref": "#/components/schemas/ReplaceItemRequest"
},
{
"$ref": "#/components/schemas/ItemToReplace"
}
,
{
"$ref": "#/components/schemas/UpdateItemRequest"
}
]
}
}
},
"required": true
},
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AddItemRequest"
},
"example": {
"message": "Error requesting picking action"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"description": "Error message.",
"type": "string"
}
}
},
"example": {
"message": "Error requesting picking action"
}
}
}
},
"401": {
"description": "Unauthorized",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"description": "Authentication failed due to missing, invalid, or expired credentials. Ensure the `X-VTEX-API-AppKey` and `X-VTEX-API-AppToken` headers include valid values.",
"type": "string"
}
}
},
"example": {
"message": "Unauthorized"
}
}
}
}
},
"deprecated": false
}
}
},
"security": [
{
"appKey": [],
"appToken": []
},
{
"VtexIdclientAutCookie": []
}
],
"components": {
"securitySchemes": {
"appKey": {
"type": "apiKey",
"in": "header",
"name": "X-VTEX-API-AppKey",
"description": "Unique identifier of the [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys)."
},
"appToken": {
"type": "apiKey",
"in": "header",
"name": "X-VTEX-API-AppToken",
"description": "Secret token of the [application key](https://developers.vtex.com/docs/guides/api-authentication-using-application-keys)."
},
"VtexIdclientAutCookie": {
"type": "apiKey",
"in": "header",
"name": "VtexIdclientAutCookie",
"description": "[User token](https://developers.vtex.com/docs/guides/api-authentication-using-user-tokens), valid for 24 hours."
}
},
"schemas": {
"UpdateDeadlineRequest": {
"required": ["description", "max", "min"],
"type": "object",
"description": "Contains deadline information.",
"properties": {
"description": {
"type": "string",
"description": "Reason or purpose of the deadline change."
},
"max": {
"type": "string",
"description": "Latest deadline date in ISO 8601 format."
},
"min": {
"type": "string",
"description": "Earliest deadline date in ISO 8601 format."
}
},
"example": {
"UpdateDeadline": {
"description": "Extend deadline due to delayed shipment",
"max": "2024-12-24T23:03:02Z",
"min": "2024-12-23T23:03:02Z"
}
}
},
"UpdateDeadlineResponse": {
"type": "object",
"properties": {
"order": {
"description": "Object with current deadline information.",
"type": "object",
"properties": {
"currentDeadline": {
"description": "Current deadline information.",
"type": "object",
"properties": {
"max": {
"description": "Latest deadline date in ISO 8601 format.",
"type": "string"
},
"min": {
"description": "Earliest deadline date in ISO 8601 format.",
"type": "string"
}
}
},
"deadlineChanges": {
"description": "Object containg information of the deadline changes.",
"type": "array",
"items": {
"description": "Deadline change.",
"type": "object",
"properties": {
"current": {
"description": "If the deadline changes were update.",
"type": "boolean"
},
"description": {
"description": "Reason or purpose for the update.",
"type": "string"
},
"handled": {
"description": "If the deadline changes were handled by the picker.",
"type": "boolean"
},
"max": {
"description": "Latest deadline date in ISO 8601 format.",
"type": "string"
},
"min": {
"description": "Earliest deadline date in ISO 8601 format.",
"type": "string"
},
"oldDates": {
"description": "Object containg previous deadline information.",
"type": "object",
"properties": {
"max": {
"description": "Latest deadline date in ISO 8601 format.",
"type": "string"
},
"min": {
"description": "Earliest deadline date in ISO 8601 format.",
"type": "string"
}
}
},
"updatedAt": {
"description": "An explanation about the purpose of this instance.",
"type": "string"
}
}
}
},
"orderId": {
"description": "Unique identifier of the order.",
"type": "string"
}
}
},
"success": {
"description": "Condition if the request was successful.",
"type": "boolean"
}
}
},
"AddItemRequest": {
"required": [
"type",
"orderId",
"itemId",
"quantity",
"warehouseId",
"price",
"sellingPrice",
"note",
"pickingOptions"
],
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "Action type (`ADD_ITEM`)."
},
"orderId": {
"type": "string",
"description": "Unique identifier of the order."
},
"itemId": {
"type": "string",
"description": "Unique identifier of the item."
},
"quantity": {
"type": "integer",
"description": "Quantity of items to add."
},
"warehouseId": {
"type": "string",
"description": "Unique identifier of the warehouse."
},
"price": {
"type": "integer",
"description": "Price of the item."
},
"sellingPrice": {
"type": "integer",
"description": "Selling price of the item."
},
"note": {
"type": "string",
"description": "Note to add to the item."
},
"pickingOptions": {
"required": ["onNotFound", "alternateOptions"],
"type": "object",
"description": "Items picking options.",
"properties": {
"onNotFound": {
"type": "string",
"description": "List of alternate options."
},
"alternateOptions": {
"type": "array",
"items": {
"type": "string",
"description": "ID of alternative items."
},
"description": "List of IDs of alternative items."
}
}
}
},
"example": {
"type": "ADD_ITEM",
"orderId": "1481110515526-01",
"itemId": "49",
"quantity": 2,
"warehouseId": "9029",
"price": 500000,
"sellingPrice": 200000,
"note": "TEST from VTEX PROXY 3",
"pickingOptions": {
"onNotFound": "REPLACE",
"alternateOptions": ["74"]
}
}
},
"AddQuantityRequest": {
"required": [
"type",
"orderId",
"itemId",
"newQuantity",
"unitMultiplier",
"reasonType",
"reasonDetail"
],
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "Action type (`ADD_QUANTITY`)."
},
"orderId": {
"type": "string",
"description": "Unique identifier of the order."
},
"itemId": {
"type": "string",
"description": "Unique identifier for the item."
},
"newQuantity": {
"type": "integer",
"description": "New quantity of items."
},
"unitMultiplier": {
"type": "integer",
"description": "Unit multiplier."
},
"reasonType": {
"type": "string",
"description": "Reason type."
},
"reasonDetail": {
"type": "string",
"description": "Reason detail."
}
},
"example": {
"type": "ADD_QUANTITY",
"orderId": "1481110515526-01",
"itemId": "3",
"newQuantity": 4,
"unitMultiplier": 1,
"reasonType": "TEST",
"reasonDetail": "test reason detail"
}
},
"RejectItemRequest": {
"required": [
"type",
"orderId",
"itemId",
"quantity",
"reasonType",
"reasonDetail"
],
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "Action type (`REJECT`)."
},
"orderId": {
"type": "string",
"description": "Unique identifier of the order."
},
"itemId": {
"type": "string",
"description": "Unique identifier for the item."
},
"quantity": {
"type": "integer",
"description": "Quantity of items to reject."
},
"reasonType": {
"type": "string",
"description": "Reason type."
},
"reasonDetail": {
"type": "string",
"description": "Reason detail."
}
},
"example": {
"type": "REJECT",
"orderId": "1481110515526-01",
"itemId": "1364",
"quantity": 1,
"reasonType": "INVENTORY",
"reasonDetail": "inventory unavailable"
}
},
"ReplaceItemRequest": {
"required": [
"type",
"orderId",
"itemToReplace",
"ItemToAddRequest",
"reasonType",
"reasonDetail"
],
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "Action type (`REPLACE`)."
},
"orderId": {
"type": "string",
"description": "Unique identifier of the order."
},
"itemToReplace": {
"$ref": "#/components/schemas/ItemToReplace"
},
"ItemToAddRequest": {
"$ref": "#/components/schemas/ItemToAddRequest"
},
"reasonType": {
"type": "string",
"description": "Reason type."
},
"reasonDetail": {
"type": "string",
"description": "Reason detail."
}
},
"example": {
"type": "REPLACE",
"orderId": "1481110515526-01",
"itemToReplace": {
"id": "49",
"quantity": 1
},
"ItemToAddRequest": {
"id": "17",
"quantity": 2,
"price": 20000,
"sellingPrice": 10000,
"warehouseId": "9029",
"note": "TEST from VTEX PROXY 1",
"pickingOptions": {
"onNotFound": "REPLACE",
"alternateOptions": ["74"]
}
},
"reasonType": "TEST",
"reasonDetail": "test reason detail"
}
},
"ItemToReplace": {
"required": ["id", "quantity"],
"type": "object",
"description": "Items to be replaced in the order.",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier of the item."
},
"quantity": {
"type": "integer",
"format": "int32",
"description": "Item quantity."
}
},
"example": {
"id": "49",
"quantity": 1
}
},
"ItemToAddRequest": {
"type": "object",
"description": "Items to be added in the order.",
"properties": {
"id": {
"type": "string",
"description": "Unique identifier of the item."
},
"quantity": {
"type": "integer",
"format": "int32",
"description": "Item quantity."
},
"price": {
"type": "integer",
"format": "int32",
"description": "Price of the item."
},
"sellingPrice": {
"type": "integer",
"format": "int32",
"description": "Selling price of the item."
},
"warehouseId": {
"type": "string",
"description": "Unique identifier of the warehouse."
},
"note": {
"type": "string",
"description": "Note to add to the item."
},
"pickingOptions": {
"required": ["onNotFound", "alternateOptions"],
"type": "object",
"description": "Items picking options.",
"properties": {
"onNotFound": {
"type": "string",
"description": "List of alternate options."
},
"alternateOptions": {
"type": "array",
"items": {
"type": "string",
"description": "ID of alternative items."
},
"description": "List of IDs of alternative items."
}
}
}
},
"example": {
"id": "17",
"quantity": 2,
"price": 20000,
"sellingPrice": 10000,
"warehouseId": "9029",
"note": "TEST from VTEX PROXY 1",
"pickingOptions": {
"onNotFound": "REPLACE",
"alternateOptions": ["74"]
}
}
},
"UpdateItemRequest": {
"required": [
"type",
"orderId",
"itemId",
"note",
"pickingOptions"
],
"type": "object",
"properties": {
"type": {
"type": "string"
},
"orderId": {
"type": "string"
},
"itemId": {
"type": "string"
},
"note": {
"type": "string"
},
"pickingOptions": {
"required": ["onNotFound", "alternateOptions"],
"type": "object",
"description": "Items picking options.",
"properties": {
"onNotFound": {
"type": "string"
},
"alternateOptions": {
"type": "array",
"items": {
"type": "string",
"description": "ID of alternative items."
},
"description": "List of IDs of alternative items."
}
}
}
},
"example": {
"type": "UPDATE_ITEM",
"orderId": "1479430515373-01",
"itemId": "1248",
"note": "TEST from VTEX PROXY 3",
"pickingOptions": {
"onNotFound": "REPLACE",
"alternateOptions": ["74"]
}
}
}
},
"parameters": {
"orderId": {
"name": "orderId",
"in": "path",
"description": "Unique identifier of the order.",
"required": true,
"style": "simple",
"schema": {
"type": "string",
"example": "1481050515517-01"
}
},
"Content-Type": {
"name": "Content-Type",
"in": "header",
"description": "Type of the content being sent.",
"required": true,
"style": "simple",
"schema": {
"type": "string",
"example": "application/json"
}
},
"Accept": {
"name": "Accept",
"in": "header",
"description": "HTTP Client Negotiation _Accept_ Header. Indicates the types of responses the client can understand.",
"required": true,
"style": "simple",
"schema": {
"type": "string",
"example": "application/json"
}
}
}
}
}