iotoms Docs

Update a sales order

PUT
/api/v1/sales/orders/{id}

Edits an order's lines, requestedDeliveryDate or notes. Once the order has been submitted, a reason is required and the change is recorded in its revision history; large price or discount changes flag the order for a second approval. Invoiced or cancelled orders cannot be edited.

How to use it

  1. Fetch the order with Get a sales order; only orders that are not cancelled or invoiced can be edited.
  2. Send only what changes: requestedDeliveryDate, notes, and/or the full replacement list of lines. Tax and totals are recomputed by the server.
  3. Once the order is past draft, include a reason on every update. A revision with the reason and the per-item changes is added to the history when the lines change.
  4. If the new line totals move more than 10% from before, overridePending turns true and Approve a sales order price override is needed before invoicing.

Authorization

BearerAuth
headerAuthorizationBearer <JWT>

Path Parameters

id*string

ID of the record (UUID).

Formatuuid

Header Parameters

X-TenantID*string

Your merchant's tenant code — the value typed in the Domain field on the iotoms login screen. See Concepts.

Request Body

application/json
  1. body
requestedDeliveryDate?|

New requested delivery date, YYYY-MM-DD. Leave out to keep the current date.

Formatdate
notes?|

New notes. Leave out to keep the current notes.

lines?array<>|

Full replacement set of lines (item code, quantity, optional unit, price, discount, description). Leave out to keep the lines; an empty list is rejected.

reason?|

Why the order is being changed. Required on every update once the order is no longer a draft; stored in the revision history when the lines change.

Response Body

OK

*/*
  1. response
status*string

Outcome of the call: SUCCESS when the request was handled, ERROR otherwise.

message*string

Short human-readable message describing the outcome, e.g. which record was fetched or saved.

data?

The sales order.

Example Request
curl -X PUT 'https://beta.iotoms.com/api/v1/sales/orders/497f6eca-6276-4993-bfeb-53cbbbba6f08' \  -H 'X-TenantID: your-tenant-code' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "status": "string",  "message": "string",  "data": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "orderNumber": "string",    "customerStoreId": 0,    "customerStoreName": "string",    "customerNumber": "string",    "customerNameSnapshot": "string",    "storeId": 0,    "status": "DRAFT",    "effectiveStatus": "DRAFT",    "orderDate": "2019-08-24",    "requestedDeliveryDate": "2019-08-24",    "bookedBy": "string",    "orderSource": "FIELD_APP",    "currency": "string",    "routeId": 0,    "subtotal": 0,    "discountTotal": 0,    "taxTotal": 0,    "grandTotal": 0,    "notes": "string",    "cancelReason": "string",    "overridePending": true,    "overrideApprovedBy": "string",    "overrideApprovedAt": "2019-08-24T14:15:22Z",    "invoiceId": "4f163819-178d-470c-a246-d6768476a6ec",    "invoiceNumber": "string",    "invoiceBlockedReason": "string",    "submittedAt": "2019-08-24T14:15:22Z",    "confirmedAt": "2019-08-24T14:15:22Z",    "cancelledAt": "2019-08-24T14:15:22Z",    "createdBy": "string",    "createdAt": "2019-08-24T14:15:22Z",    "updatedAt": "2019-08-24T14:15:22Z",    "lines": [      {        "id": 0,        "itemId": "string",        "description": "string",        "uomCode": "string",        "uomFactor": 0,        "quantity": 0,        "baseQuantity": 0,        "unitPrice": 0,        "discountAmount": 0,        "taxRate1": 0,        "taxRate2": 0,        "taxAmount": 0,        "lineTotal": 0,        "lineNumber": 0      }    ],    "revisions": [      {        "revisionNo": 0,        "changedBy": "string",        "changedAt": "2019-08-24T14:15:22Z",        "reason": "string",        "changes": "string"      }    ]  }}