03API reference
Distributor orders
Read your orders to distributors and make DRAFTS from order lines. Sending, readying, confirming, cancelling and receiving a distributor order are not in the API; staff do them in Rollmark.
/distributor-ordersList distributor ordersPOST/distributor-orders/draftsMake drafts from order linesGET/distributor-orders/{id}One distributor orderDELETE/distributor-orders/{id}Delete a draftPOST/distributor-orders/{id}/linesAdd an order line to a draftDELETE/distributor-orders/{id}/lines/{line_no}Remove a line from a draftList distributor orders
/distributor-ordersThe store's orders to distributors, oldest change first. Unit costs and quoted totals only for a key that also has catalog:cost:read. Needs the distributor_orders:read permission.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
status | query | "draft" | "ready" | "sent" | "confirmed" | "partially_shipped" | "shipped" | "received" | "cancelled" | "failed" | |
distributor | query | string | |
order_id | query | string | Only POs that serve this order. |
updated_since | query | string | ISO 8601 date or time. Lists what changed at or after it, oldest change first. |
limit | query | integer | Default 50. 1 to 100. |
cursor | query | string | The Up to 2048 characters. |
Responses
Headers: X-Request-Id, X-RateLimit-Remaining
| Field | Type | Description |
|---|---|---|
datarequired | object[] | |
data[].idrequired | string | |
data[].po_numberrequired | string | |
data[].distributorrequired | string | The distributor id ( |
data[].statusrequired | "draft" | "ready" | "sent" | "confirmed" | "partially_shipped" | "shipped" | "received" | "cancelled" | "failed" | |
data[].methodrequired | "api" | "manual" | How staff will place it. |
data[].ship_torequired | "shop" | "customer_ffl" | "customer_address" | |
data[].purpose | "stock" | "customer" | |
data[].distributor_order_no | string | null | The distributor's own order or confirmation number |
data[].tracking | string | null | |
data[].client_order_ids | string[] | |
data[].send_groups | object[] | One entry per customer when a direct-ship PO was sent as several distributor orders. |
data[].send_groups[].order_id | string | |
data[].send_groups[].sent_po | string | |
data[].send_groups[].status | string | |
data[].send_groups[].distributor_order_no | string | null | |
data[].linesrequired | object[] | |
data[].lines[].line_norequired | integer | |
data[].lines[].skurequired | string | |
data[].lines[].titlerequired | string | |
data[].lines[].quantityrequired | integer | |
data[].lines[].shipped_quantity | integer | |
data[].lines[].received_quantity | integer | |
data[].lines[].order_id | string | null | |
data[].lines[].order_line_no | integer | null | |
data[].lines[].unit_cost_cents | integer | null | Only for a key with |
data[].quoted | object | Only for a key with |
data[].quoted.subtotal_cents | integer | null | |
data[].quoted.shipping_cents | integer | null | |
data[].quoted.tax_cents | integer | null | |
data[].quoted.total_cents | integer | null | |
data[].created_at | string (date-time) | null | |
data[].ready_at | string (date-time) | null | |
data[].sent_at | string (date-time) | null | |
data[].confirmed_at | string (date-time) | null | |
data[].shipped_at | string (date-time) | null | |
data[].received_at | string (date-time) | null | |
data[].cancelled_at | string (date-time) | null | |
data[].cancel_reason | string | null | |
data[].updated_atrequired | string (date-time) | |
next_cursorrequired | string | null |
Example
Make drafts from order lines
/distributor-orders/drafts{ lines: [{ order_id, line_no, quantity?, offer_id?, ship_to? }] }, up to 100. Rollmark plans what is not given (the quantity still to order, the best offer, where it is delivered under the store's drop-ship settings) and makes one draft per distributor and place. Lines that cannot be planned come back in skipped. Nothing is sent: a draft costs nothing and staff review and send it in Rollmark. 201 when a draft was made, else 200. Needs the distributor_orders:write permission.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
Idempotency-Key | header | string | 1 to 255 printable characters (a UUID is fine). The first request with a key runs and its answer is kept for 24 hours; the same request again gets the same answer with 1 to 255 characters. |
Request body
| Field | Type | Description |
|---|---|---|
linesrequired | object[] | 1 to 100 items. |
lines[].order_idrequired | string | |
lines[].line_norequired | integer | |
lines[].quantity | integer | At least 1. |
lines[].offer_id | string | |
lines[].ship_to | "shop" | "customer_ffl" | "customer_address" |
Responses
| Field | Type | Description |
|---|---|---|
datarequired | object[] | |
data[].idrequired | string | |
data[].po_numberrequired | string | |
data[].distributorrequired | string | The distributor id ( |
data[].statusrequired | "draft" | "ready" | "sent" | "confirmed" | "partially_shipped" | "shipped" | "received" | "cancelled" | "failed" | |
data[].methodrequired | "api" | "manual" | How staff will place it. |
data[].ship_torequired | "shop" | "customer_ffl" | "customer_address" | |
data[].purpose | "stock" | "customer" | |
data[].distributor_order_no | string | null | The distributor's own order or confirmation number |
data[].tracking | string | null | |
data[].client_order_ids | string[] | |
data[].send_groups | object[] | One entry per customer when a direct-ship PO was sent as several distributor orders. |
data[].send_groups[].order_id | string | |
data[].send_groups[].sent_po | string | |
data[].send_groups[].status | string | |
data[].send_groups[].distributor_order_no | string | null | |
data[].linesrequired | object[] | |
data[].lines[].line_norequired | integer | |
data[].lines[].skurequired | string | |
data[].lines[].titlerequired | string | |
data[].lines[].quantityrequired | integer | |
data[].lines[].shipped_quantity | integer | |
data[].lines[].received_quantity | integer | |
data[].lines[].order_id | string | null | |
data[].lines[].order_line_no | integer | null | |
data[].lines[].unit_cost_cents | integer | null | Only for a key with |
data[].quoted | object | Only for a key with |
data[].quoted.subtotal_cents | integer | null | |
data[].quoted.shipping_cents | integer | null | |
data[].quoted.tax_cents | integer | null | |
data[].quoted.total_cents | integer | null | |
data[].created_at | string (date-time) | null | |
data[].ready_at | string (date-time) | null | |
data[].sent_at | string (date-time) | null | |
data[].confirmed_at | string (date-time) | null | |
data[].shipped_at | string (date-time) | null | |
data[].received_at | string (date-time) | null | |
data[].cancelled_at | string (date-time) | null | |
data[].cancel_reason | string | null | |
data[].updated_atrequired | string (date-time) | |
skippedrequired | object[] | Lines that could not be planned, with why. The rest were made. |
skipped[].order_idrequired | string | |
skipped[].line_norequired | integer | |
skipped[].reasonrequired | "not_found" | "order_not_live" | "covered" | "bad_offer" | "no_offer" | "ship_to_not_allowed" | "quantity" | |
skipped[].messagerequired | string |
Example
One distributor order
/distributor-orders/{id}Status, lines, the distributor's own order number, tracking and what has shipped and been received. Needs the distributor_orders:read permission.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string |
Responses
Headers: X-Request-Id, X-RateLimit-Remaining
| Field | Type | Description |
|---|---|---|
datarequired | object | |
data.idrequired | string | |
data.po_numberrequired | string | |
data.distributorrequired | string | The distributor id ( |
data.statusrequired | "draft" | "ready" | "sent" | "confirmed" | "partially_shipped" | "shipped" | "received" | "cancelled" | "failed" | |
data.methodrequired | "api" | "manual" | How staff will place it. |
data.ship_torequired | "shop" | "customer_ffl" | "customer_address" | |
data.purpose | "stock" | "customer" | |
data.distributor_order_no | string | null | The distributor's own order or confirmation number |
data.tracking | string | null | |
data.client_order_ids | string[] | |
data.send_groups | object[] | One entry per customer when a direct-ship PO was sent as several distributor orders. |
data.send_groups[].order_id | string | |
data.send_groups[].sent_po | string | |
data.send_groups[].status | string | |
data.send_groups[].distributor_order_no | string | null | |
data.linesrequired | object[] | |
data.lines[].line_norequired | integer | |
data.lines[].skurequired | string | |
data.lines[].titlerequired | string | |
data.lines[].quantityrequired | integer | |
data.lines[].shipped_quantity | integer | |
data.lines[].received_quantity | integer | |
data.lines[].order_id | string | null | |
data.lines[].order_line_no | integer | null | |
data.lines[].unit_cost_cents | integer | null | Only for a key with |
data.quoted | object | Only for a key with |
data.quoted.subtotal_cents | integer | null | |
data.quoted.shipping_cents | integer | null | |
data.quoted.tax_cents | integer | null | |
data.quoted.total_cents | integer | null | |
data.created_at | string (date-time) | null | |
data.ready_at | string (date-time) | null | |
data.sent_at | string (date-time) | null | |
data.confirmed_at | string (date-time) | null | |
data.shipped_at | string (date-time) | null | |
data.received_at | string (date-time) | null | |
data.cancelled_at | string (date-time) | null | |
data.cancel_reason | string | null | |
data.updated_atrequired | string (date-time) |
Example
Delete a draft
/distributor-orders/{id}A draft that was never marked ready. Anything else is 409 not_a_draft. Needs the distributor_orders:write permission.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string | |
Idempotency-Key | header | string | 1 to 255 printable characters (a UUID is fine). The first request with a key runs and its answer is kept for 24 hours; the same request again gets the same answer with 1 to 255 characters. |
Responses
Headers: X-Request-Id, X-RateLimit-Remaining
| Field | Type | Description |
|---|---|---|
datarequired | object | |
data.idrequired | string | |
data.deletedrequired | true |
Example
Add an order line to a draft
/distributor-orders/{id}/lines{ order_id, order_line_no, quantity?, offer_id? }. Only a draft; any other status is 409 not_a_draft. The offer defaults to the best one from the draft's distributor. Needs the distributor_orders:write permission.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string | |
Idempotency-Key | header | string | 1 to 255 printable characters (a UUID is fine). The first request with a key runs and its answer is kept for 24 hours; the same request again gets the same answer with 1 to 255 characters. |
Request body
| Field | Type | Description |
|---|---|---|
order_idrequired | string | |
order_line_norequired | integer | |
quantity | integer | At least 1. |
offer_id | string |
Responses
Headers: X-Request-Id, X-RateLimit-Remaining
| Field | Type | Description |
|---|---|---|
datarequired | object | |
data.idrequired | string | |
data.po_numberrequired | string | |
data.distributorrequired | string | The distributor id ( |
data.statusrequired | "draft" | "ready" | "sent" | "confirmed" | "partially_shipped" | "shipped" | "received" | "cancelled" | "failed" | |
data.methodrequired | "api" | "manual" | How staff will place it. |
data.ship_torequired | "shop" | "customer_ffl" | "customer_address" | |
data.purpose | "stock" | "customer" | |
data.distributor_order_no | string | null | The distributor's own order or confirmation number |
data.tracking | string | null | |
data.client_order_ids | string[] | |
data.send_groups | object[] | One entry per customer when a direct-ship PO was sent as several distributor orders. |
data.send_groups[].order_id | string | |
data.send_groups[].sent_po | string | |
data.send_groups[].status | string | |
data.send_groups[].distributor_order_no | string | null | |
data.linesrequired | object[] | |
data.lines[].line_norequired | integer | |
data.lines[].skurequired | string | |
data.lines[].titlerequired | string | |
data.lines[].quantityrequired | integer | |
data.lines[].shipped_quantity | integer | |
data.lines[].received_quantity | integer | |
data.lines[].order_id | string | null | |
data.lines[].order_line_no | integer | null | |
data.lines[].unit_cost_cents | integer | null | Only for a key with |
data.quoted | object | Only for a key with |
data.quoted.subtotal_cents | integer | null | |
data.quoted.shipping_cents | integer | null | |
data.quoted.tax_cents | integer | null | |
data.quoted.total_cents | integer | null | |
data.created_at | string (date-time) | null | |
data.ready_at | string (date-time) | null | |
data.sent_at | string (date-time) | null | |
data.confirmed_at | string (date-time) | null | |
data.shipped_at | string (date-time) | null | |
data.received_at | string (date-time) | null | |
data.cancelled_at | string (date-time) | null | |
data.cancel_reason | string | null | |
data.updated_atrequired | string (date-time) |
Example
Remove a line from a draft
/distributor-orders/{id}/lines/{line_no}Only a draft. Needs the distributor_orders:write permission.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
idrequired | path | string | |
line_norequired | path | integer | At least 1. |
Idempotency-Key | header | string | 1 to 255 printable characters (a UUID is fine). The first request with a key runs and its answer is kept for 24 hours; the same request again gets the same answer with 1 to 255 characters. |
Responses
Headers: X-Request-Id, X-RateLimit-Remaining
| Field | Type | Description |
|---|---|---|
datarequired | object | |
data.idrequired | string | |
data.po_numberrequired | string | |
data.distributorrequired | string | The distributor id ( |
data.statusrequired | "draft" | "ready" | "sent" | "confirmed" | "partially_shipped" | "shipped" | "received" | "cancelled" | "failed" | |
data.methodrequired | "api" | "manual" | How staff will place it. |
data.ship_torequired | "shop" | "customer_ffl" | "customer_address" | |
data.purpose | "stock" | "customer" | |
data.distributor_order_no | string | null | The distributor's own order or confirmation number |
data.tracking | string | null | |
data.client_order_ids | string[] | |
data.send_groups | object[] | One entry per customer when a direct-ship PO was sent as several distributor orders. |
data.send_groups[].order_id | string | |
data.send_groups[].sent_po | string | |
data.send_groups[].status | string | |
data.send_groups[].distributor_order_no | string | null | |
data.linesrequired | object[] | |
data.lines[].line_norequired | integer | |
data.lines[].skurequired | string | |
data.lines[].titlerequired | string | |
data.lines[].quantityrequired | integer | |
data.lines[].shipped_quantity | integer | |
data.lines[].received_quantity | integer | |
data.lines[].order_id | string | null | |
data.lines[].order_line_no | integer | null | |
data.lines[].unit_cost_cents | integer | null | Only for a key with |
data.quoted | object | Only for a key with |
data.quoted.subtotal_cents | integer | null | |
data.quoted.shipping_cents | integer | null | |
data.quoted.tax_cents | integer | null | |
data.quoted.total_cents | integer | null | |
data.created_at | string (date-time) | null | |
data.ready_at | string (date-time) | null | |
data.sent_at | string (date-time) | null | |
data.confirmed_at | string (date-time) | null | |
data.shipped_at | string (date-time) | null | |
data.received_at | string (date-time) | null | |
data.cancelled_at | string (date-time) | null | |
data.cancel_reason | string | null | |
data.updated_atrequired | string (date-time) |