XM

Add Shipment

Path:

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

This API enables you to add shipments to the different line items in the order. This API is secured by x-api-key. To add shipment, the following APIs must be run sequentially:

  1. Add Items to Cart

  2. Create Shipping

  3. Add Shipping to Line Items

  4. Checkout

To add shipments to multiple orders in bulk, the Add Bulk Shipment API is used.

Headers

Content-Type : application/json

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

x-api-key : d41d8cd98f00b204e9800998ecf8****

Parameters

Type : requestBody

Name : The order ID and shipment details.

Required: true

Sample Request

Path:

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

Request Body:

{
"orderId": "2698-6683-19607",
"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: You will see this message when the shipments are successfully added to the cart.

{
"orderId": "2698-6683-19607",
"status": "Successfully added shipment"
}

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