Get a product by key
const url = 'https://api.ebitex.io/commerce/delivery/v1/products/example';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.ebitex.io/commerce/delivery/v1/products/example \ --header 'Authorization: Bearer <token>'Returns one product: its key, name, type (the product type’s key), attributes (the merchant’s attribute document), primaryCategory and categories (each { path, name }), media (references to Assets items, { provider, key, position }, position 0 being the primary image: Commerce stores no files), axes (the options, such as Size, with their values) and variants. A variant is { sku, options, price, availability }.
A price is amountMinor, a whole number of the currency’s minor units, beside currency and amount, the same amount as a decimal string in the currency’s own exponent ("89.50", or "5000" for JPY). Show amount and do arithmetic on amountMinor; never use a floating-point number for money. taxIncluded says whether the stored price already includes tax, which is the store’s setting. A variant that has no price in this store has price: null: it is unpriced, which is not the same as free. A store may sell in several currencies: add currency=EUR to price a read in another currency the store sells in (the store’s own by default; one it does not sell in is 400 invalid_currency). A price the merchant set for that currency is returned as set; otherwise the store’s own price is converted at the store’s rate and rounded to the smallest unit of the currency, and a variant that cannot be converted (no rate) is unpriced.
availability is a status, never a count: inStock, backorder or outOfStock. A variant that is not counted (a digital good) is always inStock. The catalogue routes are cached for up to five minutes, so the status is for display: before you take an order, ask GET /stock, which is never cached.
The response carries an ETag; send it back as If-None-Match and an unchanged product answers 304. Responses are private, no-cache: revalidate rather than store.
A key reads one store. It sees only the products that store lists and that are active, and for each product only its active variants. A draft, an archived or an unlisted product answers exactly as a product that does not exist, so a key cannot learn that one is there.
Key: a Commerce delivery key (commerce.delivery.read), minted for one store in Commerce. A key with an origin or IP restriction is browser-safe: it reads the same catalogue, but is told exact stock counts only if the store allows it.
Authorizations
Section titled “Authorizations”Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters”Responses
Section titled “ Responses ”OK
missing_api_key or invalid_api_key: no key was sent, or it is unknown, revoked or expired, or its store binding was removed.
payment_required: the organization’s subscription needs attention.
scope_denied: the key lacks commerce.delivery.read. app_not_available: Commerce is not enabled for the organization. origin_denied or ip_denied: the key was used from an origin or address outside its restrictions.
product_not_found: there is no such product, or this key may not see it.
rate_limited: the key spent its requests-per-minute budget; Retry-After says how long to wait. too_many_failed_authentications: too many bad keys from this address.