Change the prices and stock of many of the caller's Offers by Seller SKU
شرح نقطههای پایانی در مرجع API به انگلیسی است؛ واژهها و قالبها همان است که در پاسخها میبینید.
نمونهها نشانی محیط اصلی را دارند، اما «امتحان کنید» همان درخواست را فقط به محیط آزمایشی میفرستد. کلید محرمانه شما نه در این سایت ذخیره میشود و نه در گزارشهای آن میآید.
Changes the stock, the Minimum Order Quantity or the Price Tiers of 1 to 100 of the caller's Offers, each found by its Seller SKU, compared as the Seller SKUs of one Seller are: Persian and Arabic-Indic digits read as Latin ones, case ignored. Each change applies only what it names and keeps the rest of the Offer's terms. Without a version it applies to the Offer as it is, so the last write wins, as a Seller's own system, the source of its prices, needs; with one, an Offer that changed since is STALE.
Each change answers in the order sent, and one change's outcome never stops another's: SAVED, with the offerId and the new version; UNCHANGED, with both, when what it names equals the Offer's, which keeps its version; STALE; NOT_FOUND when no Offer of the caller's Seller has the Seller SKU, or its Variant left its Draft and is not Published; or REFUSED, with the offerId and errors, when the Offer's state refuses it, which saves nothing of the change: PRICE_TIERS_MUST_START_AT_MINIMUM when new Price Tiers don't start at the Offer's Minimum Order Quantity, or a new Minimum Order Quantity sent alone is not where the Offer's Price Tiers start; OFFER_IN_REVIEW for other Price Tiers or another Minimum Order Quantity of a First Offer while its Product's first Review runs, though its stock stays free; and OFFER_HAS_DISCOUNT for other Price Tiers or another Minimum Order Quantity while a Discount is set on the Offer. A change of the Price Tiers or the Minimum Order Quantity is a Price Change, recorded with the caller's Account, an API Key's included; a change of stock alone never is.
Every refused value comes back at once as INVALID_VALUES, before anything is read: INVALID_SELLER_SKU and OFFER_SELLER_SKU_CHANGE_REPEATED at changes[i].sellerSku, OFFER_SELLER_SKU_CHANGE_EMPTY at changes[i] for a change that names none of stock, minimumOrderQuantity and priceTiers, STOCK_OUT_OF_RANGE, MINIMUM_ORDER_QUANTITY_OUT_OF_RANGE, and for the tiers TIER_QUANTITY_OUT_OF_RANGE, UNIT_PRICE_OUT_OF_RANGE, NOT_WHOLE_TOMAN, PRICE_TIERS_MUST_START_AT_MINIMUM when the change sends both, PRICE_TIERS_NOT_ASCENDING and PRICE_TIER_NOT_CHEAPER, each at the tier member that holds the mistake, such as changes[2].priceTiers[1].unitPrice. No change, or more than 100, and priceTiers of none or more than 10, are VALIDATION_FAILED.
An API Key's call counts one request against its limit for every 10 changes it sends, begun. Repeating the call with the same Idempotency-Key replays the first answer. The call needs a token of the chasbi realm whose Account holds the Seller power PRODUCTS_AND_PRICES: the owner, or a Seller Member with the role MANAGER or PRODUCTS_AND_PRICES; or an access token of the chasbi-partners realm for an API Key of the Seller with the role MANAGER or PRODUCTS_AND_PRICES. Any other token is refused with ACCESS_DENIED.
oauth2AuthorizationBearer <token>An access token of the chasbi-partners realm, made by the client-credentials grant with an API Key's client id and secret in the Authorization: Basic header. It lives five minutes and comes with no refresh token: ask for a new one when it ends.
Idempotency-Key?stringMakes the call safe to repeat. Send a new key with every new request, such as a random UUID, as a Structured Field String (RFC 9651): 1 to 255 printable ASCII characters in double quotes, with \" and \\ escaped, as in "8e03978e-40d5-43e8-bc93-6894a57f9324". Chasbi keeps each key for 24 hours from the start of the request it runs, for the caller whose token sent it.
Within 24 hours, the same key with the same method, path, query and body, byte for byte, gets the first answer again, with its status, Location and body and the header Idempotent-Replayed: true, and the call isn't made a second time. A body serialized differently is another request. That holds for a refusal (4xx) too, so after a refusal, send a new key once you've changed anything; an answer of 500 or more isn't kept, so the request may be sent again with the same key. The same key with another request is 422 IDEMPOTENCY_KEY_REUSED. While the first request with the key is still being processed, the key is 409 IDEMPOTENCY_KEY_IN_USE; send the request again in a moment. If the first request hasn't answered 5 minutes after it started, it is taken as lost, and the same key runs the request again. A value that isn't such a string is 400 VALIDATION_FAILED, with TYPE_MISMATCH for Idempotency-Key. With the header, a JSON body over 1 MiB is 413 CONTENT_TOO_LARGE. Without the header, the call is made every time it is sent.
application/json- body
Changes to 1 to 100 of the caller's Offers, each found by its Seller SKU.
changes*array<>One change per Offer, each Seller SKU named once.
1 <= items <= 100Each change's outcome, in the order sent.
application/json- response
What became of each change, in the order sent.
results*array<>One result per change, in its order.
curl -X POST 'https://api.chasbi.com/v1/me/offers/seller-sku-changes' \ -H 'Idempotency-Key: "8e03978e-40d5-43e8-bc93-6894a57f9324"' \ -H 'Content-Type: application/json' \ -d '{ "changes": [ { "sellerSku": "string" } ]}'{ "results": [ { "errors": [ { "code": "string", "field": "string" } ], "offerId": "42da58f8-9040-4cf5-98ce-bce9965cca0d", "outcome": "SAVED", "sellerSku": "string", "version": 0 } ]}