Skip to main content

Version: v1

List Orders

Retrieve a paginated list of orders for a specific store.


HTTP Method & Endpoint​

GET | /order


Request​

Headers​

HeaderValueDescription
Content-Typeapplication/jsonSpecifies that the response will be in JSON format
AuthorizationBearer {token}Authentication token (replace {token} with your actual token)
x-store-id{storeId}StoreId (replace {storeId} with your actual storeId)

Query Parameters​

ParameterTypeRequiredDescription
pageNumberNoPage number to fetch (default: 1)
limitNumberNoNumber of items per page (default: 10)

Response Format​

Success Response (200 OK)​

FieldTypeDescription
messageStringStatus message indicating the result of the operation
dataDataContains the list of orders and pagination details
sourceStringSource of the order data (e.g., "db")

Data Object Properties​

FieldTypeDescription
ordersArray(Order)List of order objects
paginationPaginationPagination metadata

Order Object Properties​

FieldTypeDescription
idStringUnique identifier for the order
storeIdStringStore ID associated with the order
customerIdStringCustomer's unique identifier
statusStringOrder status (e.g., "PENDING")
fulfillmentStatusStringFulfillment status (e.g., "PENDING")
purchaseDateStringISO timestamp of when order was placed
paymentMethodenum(COD,CVS)Payment method used (e.g., "COD")
totalAmountNumberTotal amount of the order
orderItemsArray(OrderItem)List of items in the order

OrderItem Properties​

FieldTypeDescription
variantIdStringID of the product variant
titleStringProduct title
descriptionStringProduct description
brandNameStringBrand name of the product
quantityNumberQuantity ordered
priceNumberPrice per unit

Pagination Object Properties​

FieldTypeDescription
totalItemsNumberTotal number of items available
currentPageNumberCurrent page number
totalPagesNumberTotal number of pages
pageSizeNumberNumber of items per page

Examples​

cURL​

curl -X GET "https://dev-sfapi.unisouk.com/order?page=1&limit=10" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer <TOKEN>" \
-H "x-store-id: <STORE_ID>"

Javascript (React)​

import axios from "axios";

const fetchOrders = async () => {
try {
const response = await axios.get("https://dev-sfapi.unisouk.com/order?page=1&limit=10", {
headers: {
"Content-Type": "application/json",
Authorization: "Bearer <TOKEN>",
"x-store-id": "<STORE_ID>",
},
});

console.log("Orders fetched:", response.data);
} catch (error) {
console.error("Error fetching orders:", error.response?.data || error.message);
}
};

Sample Response​

{
"message": "Orders fetched successfully",
"data": {
"orders": [
{
"id": "123",
"storeId": "124",
"customerId": "124",
"status": "PENDING",
"fulfillmentStatus": "PENDING",
"purchaseDate": "2025-03-25T11:50:23.890Z",
"paymentMethod": "COD",
"totalAmount": 100,
"orderItems": [
{
"variantId": "123",
"title": "test",
"description": "testing",
"brandName": "test",
"quantity": 1,
"price": 1
}
]
}
],
"pagination": {
"totalItems": 10,
"currentPage": 1,
"totalPages": 1,
"pageSize": 10
}
},
"source": "unisouk"
}

Error Responses​

Status CodeDescription
400Bad Request - Invalid parameters or validation failed
401Unauthorized - Authentication token is missing or invalid
403Forbidden - Insufficient permissions
500Internal Server Error - Something went wrong on the server