Skip to main content
This recipe reads every product your key is offered with GET /api/v1/products, 100 per page, pausing a second between pages, and prints each page’s count and the total. Replace the comment “Store the products here” with your own storage, keyed by product_id.

Prerequisites

  • MART_API_KEY: your API key, with the catalog:read scope.
  • MART_API_BASE: https://sandbox.mart.ps while you build, https://mart.ps when you go live.
One runtime: cURL 7.84 or later with jq; Node 22.18 or later, which runs the .ts file as it is; Python 3.9 or later with httpx; PHP 7.4 or later with its curl extension; Go 1.22 or later; or Java 17 or later with Jackson (jackson-databind). Each file reads its variables from the environment and sets a timeout on every call. Run it on your own server: a browser or an app never holds the key.

Run the recipe

Verify the result

The total counts inactive and out-of-stock products too; compare it with the ids from GET /api/v1/products/ids. An incremental sync cannot see a price change, so run this full sync on a schedule as well: see Sync the catalogue.

Troubleshooting

Every other code is in the error catalog.