BETA

Importing Order Patches

The Order Patch endpoint can be used to import updates to ReturnInfo, Parcel, and Delivery of an existing Order. The Order update data is represented by OrderPatchImport and loaded in an OrderPatchImportRequest, which is posted to import OrderPatches.

To monitor an import status, use Get ImportSummary, Get ImportOperation, and Query ImportOperations.

Representations

OrderPatchImportRequest

The request body to import OrderPatches. The data to be imported are represented by OrderPatchImport.

type
String
"order-patch"

The order patch import resource type.

patches
Array of OrderPatchImport

The order patches of this request

MaxItems: 20
Example: json
{
"type" : "order-patch",
"patches" : [ {
"orderNumber" : "12345",
"fields" : {
"addReturnInfo" : {
"items" : [ {
"quantity" : 1,
"lineItemId" : "1",
"comment" : "any comment",
"shipmentState" : "Advised"
} ],
"returnTrackingId" : "returnTrackingId-example",
"returnDate" : "2021-04-30T09:21:15.003Z"
},
"addDeliveries" : [ {
"items" : [ {
"id" : "4ce24c27-cce5-447c-890e-0d6b70b690be",
"quantity" : 5
} ],
"parcels" : [ {
"measurements" : {
"heightInMillimeter" : 20,
"lengthInMillimeter" : 40,
"widthInMillimeter" : 5,
"weightInGram" : 10
}
} ]
} ],
"removeDelivery" : {
"id" : "95a6e7a7-b74e-4397-b0b4-37473d2e3573"
},
"removeParcelFromDelivery" : {
"parcelId" : "98840afa-ac20-4a34-a904-88d3407e2d76"
},
"addParcelToDelivery" : {
"deliveryId" : "95a6e7a7-b74e-4397-b0b4-37473d2e3573",
"measurements" : {
"heightInMillimeter" : 20,
"lengthInMillimeter" : 40,
"widthInMillimeter" : 5,
"weightInGram" : 10
}
},
"setParcelMeasurements" : {
"parcelId" : "98840afa-ac20-4a34-a904-88d3407e2d76",
"measurements" : {
"heightInMillimeter" : 20,
"lengthInMillimeter" : 40,
"widthInMillimeter" : 5,
"weightInGram" : 10
}
},
"setParcelTrackingData" : {
"parcelId" : "98840afa-ac20-4a34-a904-88d3407e2d76",
"trackingData" : {
"carrier" : "carrier data"
}
},
"setParcelItems" : [ {
"parcelId" : "98840afa-ac20-4a34-a904-88d3407e2d76",
"items" : [ {
"id" : "4ce24c27-cce5-447c-890e-0d6b70b690be",
"quantity" : 5
} ]
} ]
}
} ]
}

OrderPatchImport

Representation for an update of an Order. Use this type to import updates for existing Orders in a commercetools Project.

orderNumber
String

Maps to Order.orderNumber, String that uniquely identifies an order, unique across a project.

fields

Each field referenced must be defined in an already existing order in the commercetools project or the import operation state is set to validationFailed.

OrderField

Order fields that needs to be added or updated.

addReturnInfo

Maps to Order.returnInfo

addParcelToDelivery

Maps to Order.delivery

addDeliveries
Array of DeliveryDraft

Maps to Order.delivery

removeDelivery

Maps to Order.removeDelivery

removeParcelFromDelivery

Maps to Order.removeParcelFromDelivery

setDeliveryAddress

Maps to Order.addressDraft

setParcelMeasurements

Maps to Order.parcelMeasurements

setParcelTrackingData

Maps to Order.parcelTrackingData

setParcelItems
Array of ParcelItems

Maps to Order.parcelItems

ReturnInfo

items
Array of ReturnItemDraft
returnTrackingId
String

Maps to ReturnInfo.returnTrackingId

returnDate

Maps to ReturnInfo.returnDate

ReturnItemDraft

quantity
Float
lineItemId
String
customLineItemId
String
comment
String
shipmentState

Maps to ReturnItem.shipmentState

ReturnShipmentState

Maps to ReturnItem.shipmentState

Advised
Returned
BackInStock
Unusable

DeliveryParcel

deliveryId
String
measurements
trackingData
items
Array of DeliveryItem

DeliveryItem

id
String
quantity
Float

DeliveryDraft

items
Array of DeliveryItem
address
parcels

DeliveryParcelDraft

measurements
trackingData
items
Array of DeliveryItem

DeliveryAddressDraft

deliveryId
String
address

ParcelMeasurement

heightInMillimeter
Float
lengthInMillimeter
Float
widthInMillimeter
Float
weightInGram
Float

ParcelMeasurementDraft

parcelId
String
measurements

ParcelTrackingData

parcelId
String
trackingData

TrackingData

trackingId
String
carrier
String
provider
String
providerTransaction
String
isReturn
Boolean

ParcelItems

parcelId
String
items
Array of DeliveryItem

RemoveDeliveryDraft

id
String

RemoveParcelFromDeliveryDraft

parcelId
String

Import OrderPatches

Creates a new import request for order patches

POST
https://import.{region}.commercetools.com/{projectKey}/order-patches/import-containers/{importContainerKey}
OAuth 2.0 Scopes:
manage_orders:{projectKey}
Path parameters:
region
String

The Region in which the Project is hosted.

projectKey
String

The commercetools Project key.

importContainerKey
String

The ImportContainer used to create the resource

Response: