Get orders by query - Fabric
Get orders by query
cURL
curl --request POST \
--url https://prod01.oms.fabric.inc/api/v2/order/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"
}
'
Example Payload in Python
import requests
url = "https://prod01.oms.fabric.inc/api/v2/order/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)
HTTP Response Models
Success Response
{
"count": 100,
"limit": 10,
"offset": 1,
"orders": [
{
"orderNumber": "309019176",
"channelId": "12",
"statusCode": "ORDER_CREATED",
"items": [
{
"lineItemId": "b03b72dc-78d8-4ea4-90fc-2fe6a1fe6569",
"lineItemNumber": 1,
"itemId": "1234",
"sku": "P1234",
"shipToId": "b03b72dc-78d8-4ea4-90fc-2fe6a1fe6569",
"channelId": "WHBM",
"title": "Item",
"itemUnitPrice": 10,
"currency": "USD"
}
]
}
]
}
Error Responses
{
"message": "[filters must not be null]"
}
{
"message": "Orders not found"
}
{
"message": "Internal server error"
}