XM

Add Bulk Shipments

Path:

POST https://{baseurl}/api-order/orders/shipments-bulk

This API offers you the flexibility to add shipments to multiple orders. This is secured by x-api-key. The successMessages in the response lists all the order IDs for which shipments are added successfully and the errorMessages in the response separately list all the order IDs for which shipments could not be added due to incorrect order ID, missing lineItemId, or invalid item quantity.

Headers

Content-Type : application/json

x-site-context : { "date": "2020-08-28T02:35:27.787Z", "channel": 12, "account": 5f493c9f30ec2a0007a94fc8", "stage": "sandbox" }

x-api-key : d41d8cd98f00b204e9800998ecf8427e

Parameters

Type : requestBody

Name : The order IDs and shipment details.

Required: true

Sample Request

Path:

POST https://{baseurl}/api-order/orders/shipments-bulk
[
{
"orderId": "6562-1726-73447",
"shipments": [
{
"shipmentRef": "ref-100",
"shipmentCarrier": "Fedex",
"shipmentCarrierUrl": "https://fedex.com",
"trackingNumber": "2345367890876549",
"lineItems": [
{
"lineItemId": 1,
"quantity": 1
}
],
"shipmentStatus": "shipping",
"estimatedDeliveryDate": "2021-06-01",
"shippedDate": "2021-05-28"
}
]
},
{
"orderId": "2224-7457-16398",
"shipments": [
{
"shipmentRef": "ref-100",
"shipmentCarrier": "Fedex",
"shipmentCarrierUrl": "https://fedex.com",
"trackingNumber": "2345367890876549",
"lineItems": [
{
"lineItemId": 2,
"quantity": 1
}
],
"shipmentStatus": "awaiting",
"estimatedDeliveryDate": "2019-03-01",
"shippedDate": "2020-04-05"
}
]
}
]

Response

Response Code: 200

Message: OK

Description: The successMessages field lists the order IDs for which shipments are added. When all of the order IDs encounter errors while adding shipment in bulk, this field returns a blank array. The errorMessages field lists the order IDs for which shipments couldn't be added. The error reason could be Invalid item quantity, Unable to find the specified lineItemID, or Order ID not found. When shipments are successfully added to all of the order IDs in the requestBody, this field returns a blank array.

Sample

{
"successMessages": [
"Order: 6562-1726-73447 was sucessfully imported"
],
"errorMessages": [
"Order: 2224-7457-16398 - Error: Unable to Find lineItemId: 2 in items of order 2224-7457-16398"
]
}

Error Code: 400

Message: Not Found

Description: You will see this error when the Order ID is not found.

{
"code": "ORDER_NOT_FOUND",
"message": "Order Id Not Found"
}

Error Code: 400

Message: Bad Request

Description: You will see this error when the Order ID is lesser or greater than 15 characters.

{
"code": "REQUEST_VALIDATION",
"message": "Invalid data in body: /orderId should NOT be shorter than 15 characters"
}

Error Code: 400

Message: Bad Request

Description: You will see this error when the order quantity is greater than the pending shipment quantity.

{
"code": "ORDER_INVALID_QUANTITY",
"message": "Invalid Item Quantity"
}

Error Code: 404

Message: Not Found

Description: You will see this error when the line item ID is not found.

{
"code": "ORDER_LINE_ITEM_NOT_FOUND",
"message": "Unable to Find lineItemId: 2"
}

Error Code: 500

Message: Internal Server Error

Description: You will see this error when the account number is incorrect in the x-site-context (for a multi-tenent client).

Change Log

  • June - 2021

  • July - 2020 First updated