Find shipments - Fabric

Find shipments

cURL

curl --request POST \
  --url 'https://api.fabric.inc/v3/shipments/search?limit=10' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-fabric-channel-id: <x-fabric-channel-id>' \
  --header 'x-fabric-tenant-id: <x-fabric-tenant-id>' \
  --data '
{
  "filters": [
    {
      "condition": "EQ",
      "field": "shipment.shipmentNum",
      "value": "Shipment_112255"
    },
    {
      "condition": "IN",
      "field": "shipment.cartons.cartonNum",
      "values": [
        "Tracking_*"
      ]
    }
  ],
  "sort": "-shipment.shipDate"
}
'

Python

import requests

url = "https://api.fabric.inc/v3/shipments/search?limit=10"

payload = {
    "filters": [
        {
            "condition": "EQ",
            "field": "shipment.shipmentNum",
            "value": "Shipment_112255"
        },
        {
            "condition": "IN",
            "field": "shipment.cartons.cartonNum",
            "values": ["Tracking_*"]
        }
    ],
    "sort": "-shipment.shipDate"
}
headers = {
    "x-fabric-tenant-id": "<x-fabric-tenant-id>",
    "x-fabric-channel-id": "<x-fabric-channel-id>",
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.text)

JavaScript (Fetch)

const options = {
  method: 'POST',
  headers: {
    'x-fabric-tenant-id': '<x-fabric-tenant-id>',
    'x-fabric-channel-id': '<x-fabric-channel-id>',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    filters: [
      {condition: 'EQ', field: 'shipment.shipmentNum', value: 'Shipment_112255'},
      {condition: 'IN', field: 'shipment.cartons.cartonNum', values: ['Tracking_*']}
    ],
    sort: '-shipment.shipDate'
  })
};

fetch('https://api.fabric.inc/v3/shipments/search?limit=10', 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/search?limit=10",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'filters' => [
        [
                'condition' => 'EQ',
                'field' => 'shipment.shipmentNum',
                'value' => 'Shipment_112255'
        ],
        [
                'condition' => 'IN',
                'field' => 'shipment.cartons.cartonNum',
                'values' => [
                                'Tracking*'
                ]
        ]
    ],
    'sort' => '-shipment.shipDate'
  ]),
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>",
    "Content-Type: application/json",
    "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"
    "strings"
    "net/http"
    "io"
)

func main() {

url := "https://api.fabric.inc/v3/shipments/search?limit=10"

payload := strings.NewReader("{
  \"filters\": [
    {\n      \"condition\": \"EQ\",
      \"field\": \"shipment.shipmentNum\",
      \"value\": \"Shipment_112255\"
    },
    {\n      \"condition\": \"IN\",
      \"field\": \"shipment.cartons.cartonNum\",
      \"values\": [\n        \"Tracking_*\"\n      ]\
    }\
  ],\
  \"sort\": \"-shipment.shipDate\"\
}")

req, _ := http.NewRequest("POST", url, payload)

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>")
    req.Header.Add("Content-Type", "application/json")

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

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

fmt.Println(string(body))
}

Response

{
  "data": [
    {
      "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"
    }
  ],
  "pagination": {
    "count": 1000,
    "limit": 10,
    "offset": 1
  }
}

Errors

{
  "errors": [
    {
      "message": "Invalid request",
      "type": "CLIENT_ERROR"
    }
  ],
  "message": "Bad request",
  "type": "CLIENT_ERROR"
}
{
  "message": "Unauthorized request",
  "type": "CLIENT_ERROR"
}
{
  "message": "Internal server error",
  "type": "SERVER_ERROR"
}

Authorizations

Headers

Query Parameters

Body

Response