List the product types in use
const url = 'https://api.ebitex.io/commerce/delivery/v1/product-types';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/product-types \ --header 'Authorization: Bearer <token>'Lists the product types the store’s visible products use, ordered by key, each { key, name, fields }. fields are the type’s effective fields in order: those it inherits from its ancestors first, then its own. A field is { id, name, type, allowedValues }: id is the key of the value in a product’s attributes, name is the label to show, type is the field type (text, number, boolean or date), and allowedValues lists the values a choice field accepts; it is absent, not null, when the field has none. A type that no visible product uses (an abstract parent, a type with only drafts) is not listed.
The response carries an ETag; send it back as If-None-Match and an unchanged list answers 304. Responses are private, no-cache: revalidate rather than store. A change to a type reaches the next request.
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”Responses
Section titled “ Responses ”{ "items": [{ "key": "shoe", "name": "Shoe", "fields": [{ "id": "material", "name": "Material", "type": "text", "allowedValues": ["Leather", "Canvas"] }, { "id": "waterproof", "name": "Waterproof", "type": "boolean" }] }] }
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.
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.