Purchase orders
Update a purchase order
Changes the header of a purchase order.
purchase-orders:writepurchase-orders:write- 120/min
- May need an add-on
- Server annotation: Idempotent
Result
generated from the schema
type always goes, even if it does not change: the approval flow and the numbering series depend on it. LINES are not touched from here, because they are not published; the server calculates the totals from them. The supplier snapshot, the numbering series and the custom fields are left out of the public body. It requires the purchases add-on (402 without it); a consignment purchase order —the stored type or the one you send is consignment— also requires the consignments add-on, and without it the response is 402 with requiredAddon: consignments and nothing is written. A cancelled purchase order, or one locked in the app, cannot be edited: 409 conflict and nothing is written. Returns the full purchase order, the same projection as its GET.
Arguments
Purchase order identifier.
Limits: min length 1
Purchase order type.
Available options: subrental, stock_purchase, resale_purchase, consumable_purchase, technician, transport, repair, consignment
Supplier of the purchase order; null leaves it without a supplier (drafts only).
Issue date, in ISO 8601 with offset; null clears it.
Reference of the supplier quote; null clears it.
Limits: max length 200
Internal reference of the document; null clears it.
Limits: max length 200
Currency, as an ISO 4217 code.
Limits: min length 3, max length 3
Associated project; null unlinks it.
Associated rental order; null unlinks it.
Notes; null clears them.
Limits: max length 5000
Idempotency key chosen by the client (a UUID is recommended). Repeating the same key with the same arguments within 24 h returns the stored response without executing again; with different arguments it responds 422. It is the safe way to retry after a network failure.
Limits: min length 1, max length 255
Optimistic locking: the meta.etag you got from the detail read of this resource (or "*"). If the resource changed since, the call fails with 412 precondition_failed before writing anything; read it again and retry. Omit it to write unconditionally.
Limits: min length 1
Result
On success the result carries structuredContent with data and meta. These are the attributes of data.
Show the attributes of data
Unique purchase order identifier.
Purchase order number; null while it is a draft.
Purchase order status.
Available options: draft, pending, completed, cancelled
Purchase order type.
Available options: subrental, stock_purchase, resale_purchase, consumable_purchase, technician, transport, repair, consignment
true if the purchase order is still a draft.
Purchase order date in ISO 8601 UTC; null if not set.
Supplier identifier; null while a draft has no supplier. Resolve it against /api.
Free-form reference of the purchase order; null if it has none.
Currency of the purchase order, as an ISO 4217 code.
Subtotal before discounts and taxes, as a decimal string "1234.50".
Limits: pattern ^-?\d+\.\d{2}$
Discount total, as a decimal string "1234.50".
Limits: pattern ^-?\d+\.\d{2}$
Tax total, as a decimal string "1234.50".
Limits: pattern ^-?\d+\.\d{2}$
Taxable base, as a decimal string "1234.50".
Limits: pattern ^-?\d+\.\d{2}$
Total including taxes, as a decimal string "1234.50".
Limits: pattern ^-?\d+\.\d{2}$
Amount already paid, as a decimal string "1234.50"; null if no payment has been recorded.
Limits: pattern ^-?\d+\.\d{2}$
Associated rental order; null if it has none.
Number of that order; null if it has none.
Associated project; null if it has none.
Repair ticket that originated the purchase; null if it does not come from one.
Purchase order notes; null if it has none.
Creation date in ISO 8601 UTC.
Last modification date in ISO 8601 UTC.
An error is a result with isError: true and the problem in content[0].; there is no structuredContent. See Errors.
The same operation by REST
This tool runs PATCH /api/v1/purchase-orders/{purchaseOrderId}.
Related pages
Link to this section: Related pagesPurchase orders
Update a purchase order
Changes the header of a purchase order.
Guides
Safe writes
An assistant that can write can also write the wrong thing. Decide which tools need a person, retry without duplicating, and know what a write sets in motion.
Guides
Errors
A tool error is a result with
isError: trueand the problem in the first text block. Branch on itscode.
Was this page helpful?