Skip to content
DEV preview — API version 1.0.0 — not the public production site — Development API: dev-api.theprioryshop.co.uk

Python

These use requests (pip install requests) - the API itself has no Python-specific requirements beyond a standard HTTP client.

import os
import requests
BASE_URL = "https://dev-api.theprioryshop.co.uk"
API_KEY = os.environ["EPOS_API_KEY"] # never hardcode this
class EposApiError(Exception):
def __init__(self, code, request_id, status, message):
super().__init__(f"{code}: {message} (request {request_id})")
self.code = code
self.request_id = request_id
self.status = status
def epos_get(path, params=None):
response = requests.get(
f"{BASE_URL}{path}",
headers={"Authorization": f"Bearer {API_KEY}"},
params=params,
)
body = response.json()
if not response.ok:
error = body["error"]
raise EposApiError(error["code"], error["requestId"], response.status_code, error["message"])
return body
products = epos_get("/v1/catalog/products", params={"pageSize": 20})
print(products["total"], "products total,", len(products["rows"]), "on this page")
product = epos_get("/v1/catalog/products/clx1product000001")

List categories, promotions, inventory stock

Section titled “List categories, promotions, inventory stock”
categories = epos_get("/v1/catalog/categories")
promotions = epos_get("/v1/catalog/promotions")
stock = epos_get("/v1/inventory/stock", params={"storeId": "clx1store0000001"})
try:
epos_get("/v1/catalog/products/does-not-exist")
except EposApiError as err:
if err.code == "not_found":
print("No such product")
elif err.code == "rate_limited":
print("Back off and retry - see Rate Limits")
else:
print(f"EPOS API error {err.code} (request {err.request_id})")
def all_products():
page = 1
while True:
result = epos_get("/v1/catalog/products", params={"pageSize": 100, "page": page})
yield from result["rows"]
if page >= result["totalPages"]:
break
page += 1
for product in all_products():
...
from datetime import datetime, timezone
since = last_synced_at.astimezone(timezone.utc).isoformat().replace("+00:00", "Z")
changed = epos_get("/v1/catalog/products", params={"updatedSince": since})

See Catalog Sync for the full pattern.