Skip to content

Pagination & Filtering

No pagination

The Shopwave API does not use traditional pagination (offset, cursor, or page-based). List endpoints return full result sets. Use header-based filtering to scope results to the records you need.

Filtering by ID

Most GET endpoints accept a comma-separated list of IDs as a request header to filter results. If the header is omitted, all records are returned.

bash
# Fetch only products 135592 and 135593
curl https://api.staging.merchantstack.com/product \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "x-accept-version: 2.0" \
  -H "productIds: 135592,135593"
js
const response = await fetch('https://api.staging.merchantstack.com/product', {
  headers: {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
    'x-accept-version': '2.0',
    'productIds': '135592,135593'
  }
})

const data = await response.json()
// data.products contains only the two requested products

Headers, not query strings

Filter parameters are passed as request headers, not query string parameters. This is different from most REST APIs — make sure your HTTP client sends these as headers.

Filter headers by resource

Each resource uses its own filter header name:

EndpointFilter headerExample
GET /applicationapplicationIds1,2,4
GET /basketbasketIds100,200
GET /categorycategoryIds1,2,3
GET /employeeemployeeIds1,2,4
GET /invoiceinvoiceId567,5678
GET /orderorderIds1,2,4
GET /productproductIds1,2,3
GET /promotionpromotionIds1,2,4
GET /storestoreIds1,2,3
GET /supplier/storesupplierIds1,2,3

Cross-resource filtering

Some endpoints support filtering by related resources:

EndpointHeaderDescription
GET /productstoreIdInclude stock levels for a specific store
GET /productcategoryIdsFilter products by category
GET /invoicestoreIdsFilter invoices by store
GET /orderstoreIdsFilter orders by store
GET /ordercompletedFilter by completion status (true/false)
GET /promotionstoreIdsFilter promotions by store
GET /promotionactiveOnly active promotions (true/false)
GET /promotionexpiredOnly expired promotions
GET /promotionimminentPromotions starting soon

Example: Products with stock for a store

bash
# Get products in category 921 with stock levels for store 2890
curl https://api.staging.merchantstack.com/product \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "x-accept-version: 2.0" \
  -H "categoryIds: 921" \
  -H "storeId: 2890"
js
const response = await fetch('https://api.staging.merchantstack.com/product', {
  headers: {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
    'x-accept-version': '2.0',
    'categoryIds': '921',
    'storeId': '2890'
  }
})

const { products } = await response.json()
// Each product includes totalStock, stockSold, stockLeft for store 2890

Response:

json
{
  "products": {
    "135592": {
      "id": 135592,
      "name": "Classic Beef Burger",
      "categories": { "921": "Mains" },
      "totalStock": 50,
      "stockSold": 12,
      "stockLeft": 38,
      "instances": { ... }
    }
  },
  "api": { ... }
}

Logs — tag-based filtering

The Log endpoint uses a different filtering model based on tags and object keys rather than IDs:

HeaderRequiredDescription
tagYesCustom tags to filter by (e.g. "StockTake, Product")
objectYesObject type key (e.g. "STORE")
identifierYesIdentifier value (e.g. "12")
idNoDirect retrieval by composite log ID

Reports — date range filtering

Report endpoints use date range headers instead of ID filtering:

bash
# Get basket report for January 2024, store 53
curl https://api.staging.merchantstack.com/report/basket \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
  -H "x-accept-version: 2.0" \
  -H "reportFrom: 2024-01-01 00:00:00" \
  -H "reportTo: 2024-01-31 23:59:59" \
  -H "storeIds: 53"
js
const response = await fetch('https://api.staging.merchantstack.com/report/basket', {
  headers: {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
    'x-accept-version': '2.0',
    'reportFrom': '2024-01-01 00:00:00',
    'reportTo': '2024-01-31 23:59:59',
    'storeIds': '53'
  }
})

Stock reconciliation — date range filtering

The stock reconciliation endpoint also uses date ranges:

HeaderRequiredDescription
fromYesStart date-time (e.g. 2024-01-01 00:00:00)
toYesEnd date-time (e.g. 2024-06-01 00:00:00)
storeIdsYesComma-separated store IDs

Best practices

  • Filter aggressively — always pass ID filters when you know which records you need, rather than fetching everything
  • Cache where possible — resources like categories, stores, and products change infrequently
  • Use stock filtering — pass storeId when fetching products to get stock levels in a single request instead of a separate call