Platitun · API · Listings · Switch on, switch off, auto-delivery
Switch on, switch off, auto-delivery
POST /api/v1/listings/{number}/stateKey scope: listings · changes data, the Idempotency-Key header is required
One action for two switches: appearing on the storefront and delivery by stock. Switching the first on turns the price into a public offer; switching auto-delivery on promises delivery in seconds.
Auto-delivery cannot be switched on with an empty stock: promising instant delivery without stock is a lie to the buyer, and it costs a lot in the auto-delivery rating. The refusal code is auto_needs_stock.
Request fields
| Field | Type | What it is |
|---|---|---|
active | boolean | Publish or withdraw. |
autoIssue | boolean | Deliver from stock or by hand. |
Response fields
| Field | Type | What it is |
|---|---|---|
number | integer | The public number. |
isActive | boolean | The publication state after the action. |
autoIssue | boolean | The auto-delivery state after the action. |
Refusal reasons
A rule refusal arrives as {"error":"rejected","refusal":{"kind":"…"}} with status 409. Refusals common to all endpoints are in the rules section.
| Code | What happened and what to do |
|---|---|
not_found | The record does not exist or is not yours. The ownership condition is in the database query itself, so someone else’s record looks like a missing one. |
auto_needs_stock | Auto-delivery cannot be switched on with an empty stock: promising instant delivery without stock is a lie to the buyer. Refill the stock first. |
bad_request | The request is malformed: a required field is missing or a value is of the wrong kind. The specifics are in the detail field. |
Nearby in this section
GET /api/v1/listings— My listingsPOST /api/v1/listings— Create a listingGET /api/v1/listings/{number}— One of my listingsPATCH /api/v1/listings/{number}— Update a listingDELETE /api/v1/listings/{number}— Remove a listingPOST /api/v1/listings/{number}/copy— Copy a listingPOST /api/v1/listings/{number}/test— Mark a listing as testPUT /api/v1/listings/{number}/image— The listing imageDELETE /api/v1/listings/{number}/image— Remove the imageGET /api/v1/questions— Questions about my listingsPOST /api/v1/questions/{id}/answer— Answer a question