Update products
BetaAPI v2 is in public beta: endpoints, fields and behaviour can change before general availability. See the changelog
const url = 'https://app.stoqapp.com/api/v2/external/preorders/products';const options = { method: 'PATCH', headers: {'X-Auth-Token': '<X-Auth-Token>', 'Content-Type': 'application/json'}, body: '{"variants":"string","inventory_policy":"string"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://app.stoqapp.com/api/v2/external/preorders/products \ --header 'Content-Type: application/json' \ --header 'X-Auth-Token: <X-Auth-Token>' \ --data '{ "variants": "string", "inventory_policy": "string" }'Save rows of the store-wide Preorders > Products tab: link each variant to one offer or to none, and set its shipping text and quantity limit on the offers it is in.
Note: variants is a list of up to 100 rows. A row’s offer_id replaces every offer the variant is in with that one, and null takes it out of all of them, as the tab’s ‘Offer linked’ select does; omit offer_id to leave the links. Offers that sell in selected markets only cannot be picked, and a variant in one is skipped (skipped_market_shopify_variant_ids); change those on the offer itself. offers sets this variant’s shipping_text and max_count on offers it is in; shipping_text only on an offer whose shipping text is per variant, max_count (1 or more) only on an out-of-stock offer. null clears either one; a key left out is unchanged. max_count is the variant’s own limit, the same field GET /preorders/products returns, so writing a read value back changes nothing; on a batch offer it is kept but not enforced (limits there are per batch, set on the offer’s variant row with batch_limits), and quantity_limit is read-only. inventory_policy (CONTINUE or DENY) also sets ‘Continue selling’ on the variants whose offer_id changed, as the save confirm’s Turn on / Turn off does; omit it for ‘Don’t change’. Variants STOQ has not stored yet are read from Shopify. Finishes before the response.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Example
{ "variants": "string", "inventory_policy": "string"}Responses
Section titled “Responses”Success — the updated resource.
object
Example generated
{}Accepted — async/bulk work was queued. Poll the returned job.
Returned for async/bulk work — poll the job until it reaches a terminal state.
object
Example
{ "job_id": "job_a1b2c3", "status_url": "/api/v2/external/jobs/job_a1b2c3"}Missing or invalid X-Auth-Token.
Error envelope returned by every failed request.
object
Example
{ "errors": [ "Unauthorized" ]}The request failed validation.
Error envelope returned by every failed request.
object
Example
{ "errors": [ "name is required" ]}Rate limited — cost-weighted per token (read 1, write 2; 360 points / 60s). Check Retry-After.
Error envelope returned by every failed request.
object
Example
{ "errors": [ "Rate limit exceeded" ]}Thanks for letting us know.
Still stuck? Ask Quinn or chat with support