Add shipment to order - Fabric

Add shipment to order

cURL

curl --request POST \
  --url https://prod01-apigw.yourcompany.fabric.zone/api-order/orders/shipments \
  --header 'Content-Type: application/json' \
  --header 'x-site-context: <x-site-context>' \
  --data '
{
  "orderId": "2947-5955-82579",
  "shipments": [
    {
      "shipmentCarrier": "FedEx",
      "trackingNumber": "2345367890876543",
      "lineItems": [
        {
          "lineItemId": 1,
          "quantity": 2
        }
      ],
      "shipmentStatus": "Delivered",
      "shipmentRef": "ref-1234",
      "shipmentCarrierUrl": "https://www.fedex.com/",
      "shippedDate": "<string>",
      "estimatedDeliveryDate": "<string>"
    }
  ]
}
'

Python

import requests

url = "https://prod01-apigw.yourcompany.fabric.zone/api-order/orders/shipments"

payload = {
    "orderId": "2947-5955-82579",
    "shipments": [
        {
            "shipmentCarrier": "FedEx",
            "trackingNumber": "2345367890876543",
            "lineItems": [
                {
                    "lineItemId": 1,
                    "quantity": 2
                }
            ],
            "shipmentStatus": "Delivered",
            "shipmentRef": "ref-1234",
            "shipmentCarrierUrl": "https://www.fedex.com/",
            "shippedDate": "<string>",
            "estimatedDeliveryDate": "<string>"
        }
    ]
}
headers = {
    "x-site-context": "<x-site-context>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)

JavaScript (Fetch API)

const options = {
  method: 'POST',
  headers: {'x-site-context': '<x-site-context>', 'Content-Type': 'application/json'},
  body: JSON.stringify({
    orderId: '2947-5955-82579',
    shipments: [
      {
        shipmentCarrier: 'FedEx',
        trackingNumber: '2345367890876543',
        lineItems: [{lineItemId: 1, quantity: 2}],
        shipmentStatus: 'Delivered',
        shipmentRef: 'ref-1234',
        shipmentCarrierUrl: 'https://www.fedex.com/',
        shippedDate: '<string>',
        estimatedDeliveryDate: '<string>'
      }
    ]
  })
};

fetch('https://prod01-apigw.yourcompany.fabric.zone/api-order/orders/shipments', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

Response Structure

{
  "orderId": "4217-7227-80339",
  "status": "Successfully added shipment"
}