Get allocation by query - Fabric

Get allocation by query

cURL

curl --request POST \
  --url https://prod01.oms.fabric.inc/api/v2/allocation/query \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --header 'x-site-context: <x-site-context>' \
  --data '
{
  "filters": {
    "retail": {
      "locationNum": 12
    },
    "orderSubTotal": {
      "gte": 1300,
      "lt": 1400
    },
    "orderNumber": "order-*Z",
    "statusCode": [
      "ORDER_CREATED"
    ],
    "createdAt": {
      "lt": "2022-09-11T23:12:00.123Z"
    },
    "shipInfo": {
      "shipToId": [
        "23434",
        "23436"
      ]
    }
  },
  "limit": 10,
  "offset": 0,
  "sortBy": "updatedAt",
  "sortDirection": "desc"
}
'

Python

import requests

url = "https://prod01.oms.fabric.inc/api/v2/allocation/query"

payload = {
    "filters": {
        "retail": { "locationNum": 12 },
        "orderSubTotal": {
            "gte": 1300,
            "lt": 1400
        },
        "orderNumber": "order-*Z",
        "statusCode": ["ORDER_CREATED"],
        "createdAt": { "lt": "2022-09-11T23:12:00.123Z" },
        "shipInfo": { "shipToId": ["23434", "23436"] }
    },
    "limit": 10,
    "offset": 0,
    "sortBy": "updatedAt",
    "sortDirection": "desc"
}
headers = {
    "x-site-context": "<x-site-context>",
    "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-site-context': '<x-site-context>',
    Authorization: 'Bearer <token>',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    filters: {
      retail: {locationNum: 12},
      orderSubTotal: {gte: 1300, lt: 1400},
      orderNumber: 'order-*Z',
      statusCode: ['ORDER_CREATED'],
      createdAt: {lt: '2022-09-11T23:12:00.123Z'},
      shipInfo: {shipToId: ['23434', '23436']}
    },
    limit: 10,
    offset: 0,
    sortBy: 'updatedAt',
    sortDirection: 'desc'
  })
};

fetch('https://prod01.oms.fabric.inc/api/v2/allocation/query', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));

Response Example

[
  {
    "allocationId": "62ff5c0bec0aed3c86202c32",
    "parentAllocationId": "62ff5c0bec0aed3c86202c32",
    "locationNum": "1234B",
    "items": [
      {
        "itemId": "100064",
        "sku": "123k4h123k",
        "quantity": 3,
        "allocationLineNumber": 3,
        "orderLineId": "134fqfaa532qrf",
        "orderId": "123k4h123k",
        "orderDate": "2022-08-01T18:03:28.483971941Z",
        "estimatedDeliveryDate": "2022-08-01T18:03:28.483971941Z",
        "parentAllocationLineNumber": 3,
        "reallocationRequestId": "123k4h123k",
        "shippedQuantity": 1,
        "scratchQuantity": 1,
        "scratchedReasonCode": "Scratched during shipment",
        "reshipReasonCode": "Reshipping during shipment",
        "reallocationReasonCode": "Reallocating due to unavailability of location number",
        "channelId": "12",
        "vendorId": "56",
        "title": "Demo",
        "weight": 5.5,
        "cost": 500.2,
        "price": 50.2,
        "itemStatus": "ALLOCATED",
        "attributes": {},
        "uom": "KG"
      }
    ],
    "version": 2,
    "allocationRequestId": "62ff5c0bec0aed3c86202c32",
    "allocationNum": "xxyyzz12345",
    "sentToPPSDate": "2022-08-01T18:03:28.483971941Z",
    "allocationDate": "2022-08-01T18:03:28.483971941Z",
    "updatedAt": "2022-08-01T20:03:28.483971941Z",
    "type": "ALLOCATED",
    "previousAllocationLocationNum": 410,
    "poNumber": "1125",
    "itemsType": "WEB_SHIP",
    "vendorId": "56",
    "shipMethod": "Overnight Delivery",
    "shipToId": "98ff5c0bec0aed3c86202c32",
    "statusCode": "PENDING_PICK",
    "locationType": "1234B",
    "recipient": [
      {
        "name": {
          "first": "John",
          "last": "Doe"
        },
        "email": "demo@xyz.inc",
        "phone": {
          "number": "55555555555",
          "type": "MOBILE"
        }
      }
    ],
    "auditLogs": [
      {
        "lineItemId": "4",
        "auditId": "62272e917b12209e68751d94",
        "auditType": "UPDATE",
        "employeeId": "62272e917b12209e68751d94",
        "auditTimestamp": "2022-05-12T09:24:54.804Z",
        "source": "POS",
        "success": true,
        "updatedFields": [
          {
            "fieldName": "UOM",
            "fieldOriginalValue": "PK"
          }
        ]
      }
    ]
  }
]
{
  "message": "Data not found"
}
{
  "message": "Internal Server Error"
}

Authorizations

Authorization : string (Bearer authentication header)