Get shipment by ID - Fabric

Get shipment by ID

cURL

curl --request GET \
  --url https://api.fabric.inc/v3/shipments/{shipmentId} \
  --header 'Authorization: Bearer <token>' \
  --header 'x-fabric-channel-id: <x-fabric-channel-id>' \
  --header 'x-fabric-tenant-id: <x-fabric-tenant-id>'

Python

import requests

url = "https://api.fabric.inc/v3/shipments/{shipmentId}"

headers = {
    "x-fabric-tenant-id": "<x-fabric-tenant-id>",
    "x-fabric-channel-id": "<x-fabric-channel-id>",
    "Authorization": "Bearer <token>"
}

response = requests.get(url, headers=headers)

print(response.text)

JavaScript

const options = {
  method: 'GET',
  headers: {
    'x-fabric-tenant-id': '<x-fabric-tenant-id>',
    'x-fabric-channel-id': '<x-fabric-channel-id>',
    Authorization: 'Bearer <token>'
  }
};

fetch('https://api.fabric.inc/v3/shipments/{shipmentId}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

PHP

<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.fabric.inc/v3/shipments/{shipmentId}",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "x-fabric-channel-id: <x-fabric-channel-id>",
    "x-fabric-tenant-id: <x-fabric-tenant-id>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

Go

package main

import (
    "fmt"
    "net/http"
    "io"
)

func main() {

url := "https://api.fabric.inc/v3/shipments/{shipmentId}"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("x-fabric-tenant-id", "<x-fabric-tenant-id>")
    req.Header.Add("x-fabric-channel-id", "<x-fabric-channel-id>")
    req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
    body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}

Java (Unirest)

HttpResponse<String> response = Unirest.get("https://api.fabric.inc/v3/shipments/{shipmentId}")
  .header("x-fabric-tenant-id", "<x-fabric-tenant-id>")
  .header("x-fabric-channel-id", "<x-fabric-channel-id>")
  .header("Authorization", "Bearer <token>")
  .asString();

Ruby

require 'uri'
require 'net/http'

url = URI("https://api.fabric.inc/v3/shipments/{shipmentId}")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["x-fabric-tenant-id"] = '<x-fabric-tenant-id>'
request["x-fabric-channel-id"] = '<x-fabric-channel-id>'
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body

Sample Responses

Success Response (200)

{
  "version": 2,
  "allocationId": "6413e3d3fd03a35efccb426e",
  "auditLogs": [
    {
      "auditId": "a05b72dc-78d8-4ea4-90fc-2fe6a1fe1111",
      "auditType": "CANCEL",
      "auditedAt": "2023-03-12T09:24:54.804Z",
      "employeeId": "6227",
      "lineItemId": "b03b72dc-78d8-4ea4-90fc-2fe6a1fe6569",
      "note": "Note",
      "reasonCode": "Scratched item",
      "source": "POS",
      "subReasonCode": "Scratched item",
      "updatedFields": [
        {
          "fieldName": "UOM",
          "fieldOriginalValue": "PK"
        }
      ]
    }
  ],
  "cartons": [
    {
      "cartonNumber": "1",
      "cartonType": "Package",
      "estimatedDeliveryDate": "2023-04-26T07:58:30.996Z",
      "estimatedShipmentDate": "2023-03-25T07:58:30.996Z",
      "items": [
        {
          "fees": [
            {
              "amount": 34.56,
              "amountInCurrencies": [
                {
                  "currency": "USD",
                  "group": "SHOPPER",
                  "amount": 123.45
                }
              ],
              "name": "RETURN_FEE",
              "reason": "Return fee",
              "type": "FEE"
            }
          ],
          "giftCards": [
            {
              "amount": 50,
              "amountInCurrencies": [
                {
                  "currency": "USD",
                  "group": "SHOPPER",
                  "amount": 123.45
                }
              ],
              "giftCardActivatedAt": "2023-04-26T07:58:30.996Z",
              "giftCardActivationRequestedAt": "2023-03-26T07:58:30.996Z",
              "giftCardNumber": "453456765",
              "giftCardStatus": "ACTIVE"
            }
          ],
          "itemId": 100023,
          "lineItemId": "1",
          "orderId": "6413e370cb0dc859b6c0dcb0",
          "orderNumber": "309020213",
          "orderedQuantity": 2,
          "refundAmount": 10,
          "refundAmountInCurrencies": [
            {
              "currency": "USD",
              "group": "SHOPPER",
              "amount": 123.45
            }
          ],
          "returnQuantity": 1,
          "segment": "segment",
          "shipmentLineItemId": "607f1f77bcf86cd799439011",
          "shippedQuantity": 2,
          "sku": "SKU0023",
          "uom": "EA",
          "vendorId": "vend12346667"
        }
      ],
      "promisedDeliveryDate": "2023-03-26T07:58:30.996Z",
      "shipmentCarrier": "FEDEX",
      "shipmentMethod": "ground",
      "tracking": [
        {
          "event": "picked up",
          "eventId": "627963716b19511e8a3a631b",
          "eventRecordedAt": "2019-09-30T07:58:30.996Z",
          "location": "Reno, NV",
          "notes": {
            "description": "Shipment picked up"
          },
          "shipmentCarrier": "FEDEX"
        }
      ],
      "trackingNumber": "1Z999AA10123456784",
      "trackingURL": "https://example.com/tracking",
      "weight": "500 grams"
    }
  ],
  "createdAt": "2023-04-06T07:58:30.996Z",
  "invoiceId": "63ef4360aafa8a7f5247fe48",
  "locationNumber": "WH334",
  "locationType": "DC",
  "masterTrackingNumber": "TX112345678",
  "orderNumbers": [
    "309020213, 459020213"
  ],
  "poNumber": "1125",
  "recipients": [
    {
      "email": "support@example.inc",
      "name": {
        "firstName": "Alex",
        "lastName": "Doe",
        "middleName": "E"
      },
      "phone": {
        "number": "123-456-7890",
        "type": "MOBILE"
      }
    }
  ],
  "reshipmentReasonCode": "Order is missing",
  "scratchedItems": [
    {
      "reasonCode": "ReasonCode23454",
      "itemId": 100043,
      "lineItemId": "2",
      "orderId": "6413e370cb0dc859b6c0dcb0",
      "quantity": 1,
      "sku": "SKU00043",
      "subReasonCode": "SubReasonCode23242",
      "uom": "EA"
    }
  ],
  "shipToAddress": {
    "addressLine1": "123 Main St.",
    "city": "Seattle",
    "countryCode": "US",
    "latitude": 47.6205,
    "longitude": -122.3493,
    "postalCode": "98121",
    "region": "WA",
    "type": "Home",
    "addressLine2": "Suite 100",
    "addressLine3": "Seventh floor",
    "addressLine4": "Attention: Pat E. Kake",
    "email": "test@example.com",
    "name": {
      "firstName": "Alex",
      "lastName": "Doe",
      "middleName": "E"
    },
    "phone": {
      "number": "123-456-7890",
      "type": "MOBILE"
    }
  },
  "shipToId": "1",
  "shipmentId": "627963716b19511e8a3a631b",
  "shipmentNumber": "78974156816152",
  "shipmentExternalId": "123k4h123k",
  "shippedAt": "2023-04-06T07:58:30.996Z",
  "statusCode": "SHIPMENT_CREATED",
  "subtype": "COD",
  "totalCartons": 2,
  "type": "STANDARD",
  "updatedAt": "2023-04-06T07:58:30.996Z",
  "vendorId": "56"
}

Error Response (400)

{
  "errors": [
    {
      "message": "Invalid request",
      "type": "CLIENT_ERROR"
    }
  ],
  "message": "Bad request",
  "type": "CLIENT_ERROR"
}

Error Response (401)

{
  "message": "Unauthorized request",
  "type": "CLIENT_ERROR"
}

Error Response (404)

{
  "message": "Shipment not found",
  "type": "CLIENT_ERROR"
}

Error Response (500)

{
  "message": "Internal server error",
  "type": "SERVER_ERROR"
}