Updating documents
Only a document in draft state can be amended.
Tip
In API v1.0 only a subset of fields were supported for update.
From API v1.1 any field of the document or document detail can be updated.
Updating a document is done by PATCH
, the fields provided will be updated.
Examples
PATCH /api/document/{docRef}
{
"Description" : "Order 100",
"TheirDocNo": "PO-199233",
"DocDate": "2020-05-10"
}
Updates the provided fields.
Updating document details
Replace all documents
While updating a document, providing the Details
property will replace all existing details:
PATCH /api/document/SIN100
{
"Description" : "Amended order details",
"Details": [
{ "Description": "line1", "ProductId": "P100", "IntRef": "L1" },
{ "Description": "line2", "ProductId": "P101", "IntRef": "L2" }
]
}
Update a single line
A single line can be patched by id
or intRef
:
PATCH /api/document/SIN100/detail/L1
{ "Description": "line1 discounted", "CurrencyUnitPrice": 99 }
Add a line to a document
POST /api/document/SIN100/detail
{ "ProductId": "RoyalMail1st", "CurrencyUnitPrice": 3.99 }
Updating custom fields
Note that the update of custom fields via the Ext
object will merge the data.
- Existing properties not specified in the update will remain.
- Existing properties that already exist will be replaced.
- To delete an existing property, update with a
null
value.