Skip to content

HTTP conventions

Every response that carries one business object (a read, a create, a change, a lifecycle move, a delete) also carries its revision:

ETag: W/"3f1c9a0b7d2e4c65"
Cache-Control: no-store

Send it back in If-Match to make a write conditional on the business object being unchanged:

PATCH /api/business-object/sales/SalesOrder/01J…
If-Match: W/"3f1c9a0b7d2e4c65"
  • If-Match is honored by PATCH, DELETE, activate, archive, restore and running an action.
  • Without the header, or with *, the write is not checked.
  • If the business object has changed since, the answer is 412 with core.stale_revision, and nothing is written. Read it again and decide anew.

The revision covers the fields people and integrations enter. Values the system keeps (totals, statuses, invoiced and picked quantities) do not change it, so an open order that is being picked does not turn stale. A decision based on such a value, like reducing a quantity because nothing was picked yet, is not protected by the revision; the document’s own rules guard it.

Two writes racing between the check and the save are still caught: the later one answers 409 with core.concurrent_modification.

Lists carry no revision.

A network failure does not say whether a write happened. Send an Idempotency-Key header on the write, and reuse the same key when retrying it:

POST /api/business-object/sales/SalesInvoice
Idempotency-Key: 9b2f6c1e-2d4a-4c0e-8f1a-6a2c7d1e3b55
  • The key is chosen by the caller: 1 to 255 printable ASCII characters. A fresh value per intended write, such as a UUID, is the safe choice. Two different keys are two writes.
  • A key is scoped to the workspace and remembered for 24 hours after the write commits.
  • A repeat answers with the first response’s body and status, byte for byte, including the document number drawn. It is a copy of the first answer, not a fresh read.
  • A repeat that arrives while the first request is still running answers 409 with core.request_in_flight. Retry it after a short pause.
  • A write that failed releases its key, so the retry is a real attempt.
  • A request with a key fails while the key store is unreachable, rather than running unprotected. Requests without a key are unaffected.

Honored on creating, changing and deleting business objects, on activate, archive and restore, and on running an action. Not honored on functions, file uploads or role management.

Every error answers with the same JSON body:

{
"code": "core.business_object_locked",
"status": 422,
"detail": "sales/SalesInvoice is locked in status 'active'",
"businessObject": "sales/SalesInvoice",
"lifecycleState": "active"
}

code is the stable value to branch on. status repeats the HTTP status. detail is an English sentence for logs, and may change. Any further fields belong to the code.

Code Status Meaning
core.validation_failed 400 The values were refused. issues lists each one: path, message, and the business object it belongs to
core.invalid_cursor 400 The cursor belongs to a different list question
core.request_rejected 4xx The request was malformed in a way with no more specific code
core.unauthorized 401 No valid key or session
core.workspace_not_found 401 The credential names a workspace that no longer exists
core.forbidden 403 The account’s roles lack permission
core.no_active_workspace 403 The credential belongs to no workspace
core.workspace_membership_ended 403 The account is no longer a member of that workspace
core.not_found 404 No such business object
core.action_not_available 409 The action does not apply to the business object in its current state
core.transition_not_allowed 409 The lifecycle move is not allowed from lifecycleState
core.concurrent_modification 409 Another write to the same business object committed first
core.request_in_flight 409 The same idempotency key is still running
core.stale_revision 412 If-Match no longer matches
core.business_object_locked 422 The document is released or otherwise sealed against this change
core.cross_bo_reference 422 Other business objects still reference this one; blockers names them
core.tree_children 422 The business object still has children in a hierarchy
core.internal 5xx Something failed on the server. The cause is logged there, never sent

Business areas add their own codes, named after the area: sales.nothing_to_invoice, inventory.negative_stock and so on. Treat an unknown code by its status and show its detail.

GET /api/broadcast is a server-sent events stream that tells the OnERP app which business object changed, so open screens refresh. Each changed event names the kind of business object and its id, and only for kinds the caller may read.

It is built for open browser tabs, not for integrations. Nothing is stored or replayed: an event sent while the connection is down is gone, and the event carries no data beyond the id. An integration that must not miss a change reads the business objects it cares about on its own schedule.