In short
lines in a PATCH replaces the set: a line with an id is updated, one without is added, one left out is removed.Idempotency-Key header.subtotal is computed from the lines, before tax. Tax amounts, totals and price lists are not applied for you.The API writes sales orders, purchase orders and bills through the same rules as NutraSoft's own forms. This page covers what those writes have in common.
/sales-ordersCreate a sales order/purchase-ordersCreate a purchase order/billsCreate a billlines accepts 1 to 200 lines on sales orders and purchase orders. One more is refused with 400 INVALID_REQUEST, and details points at body.lines.lines as an empty list on an update is refused.lines in a PATCH to leave the lines as they are.lines to replace the whole set: a line with an id updates that line in place, a line without one is added, and every existing line you leave out is removed.GET first. Lines are returned by the detail and write operations, and are null on list operations.id that is not a line of this document is refused with 400.cost:read. Without it price reads null, and a line sent back without its price loses it./sales-orders/{sales_order_id}Update a sales order/purchase-orders/{purchase_order_id}Update a purchase ordersubtotal is computed from the lines and is not accepted in a request. It is before tax.tax1 and tax2, whether each tax applies, with their rates tax1_rate and tax2_rate.uom_type, purchase order and bill lines in purchase units.POST /bills and POST /purchase-orders accept an Idempotency-Key header: your own unique string, up to 200 characters. Replaying a request with the same key and the same body returns the document the first request created, with 200, instead of creating a second one. Reusing a key with a different body is refused with 409 CONFLICT.
A sales order is created OPEN. The only status change the API makes is cancelling it; shipping and invoicing in NutraSoft move an order through its other statuses. An order that was paid through your NutraSoft online store cannot be cancelled over the API and returns 409: cancel it in NutraSoft, which refunds the payment.
The status operation publishes the ordering path only: SENT, CONFIRMED, CANCELLED and CLOSED. RECEIVED and BACK_ORDER are written by receiving in NutraSoft.
If your account blocks unapproved suppliers, creating an order for a suspended or rejected supplier, or moving an order to one, is refused with 409. A supplier whose approval is pending or has expired is not blocked.
CLOSE, a purchase order uses CLOSED.The status operation can set PLANNED, ON_HOLD, QUARANTINE and CANCELLED. Starting a run (IN_PROGRESS, IN_PROGRESS_TRANSFORMATION) and completing it (COMPLETED) happen on the shop floor, where signatures, equipment calibration and pre-operational checks are enforced, so the API refuses them with 409.
lot_number is required. A lot that already exists with a different expiration date is refused with 409.quantity and cost are per purchase unit; the lot is recorded in base units.purchase_order_id does not advance or close the order. Use the purchase order status operation for that.is_global, are read-only: changing one is 403 READ_ONLY.null for a field that cannot be null is refused with 400. See Conventions.