Skip to main content

Revert SI Drafts API

Introduction​

Reverts a summary invoice (SI) draft represented by an InvoiceOriginal payload using InvoiceService.revertFromSIDrafts. Used when discarding or unwinding a draft before it becomes a final generated invoice. On success, writes an invoicing activity log entry.

Source: InvoiceHomePageAPI.revertFromSIDrafts (@Path("revertSIDrafts")).

See also: Invoice Home — all endpoints.


HTTP Endpoint​

PropertyValue
URL/rest/invoicehome/revertSIDrafts
MethodPOST
ConsumesRaw JSON body
Producestext/plain (JSON string entity)

Request Body (JSON)​

FieldTypeRequiredDescription
userIdStringYesActing user for activity log.
userNameStringYesAuth username.
authKeyStringYesAuth key.
invoiceOriginalDataObjectYesJSON object deserialised to InvoiceOriginal with Gson (not a string — unlike delete/revert generated endpoints).

Authentication​

ConditionHTTP status
Invalid credentials401 Unauthorized (Access-Control-Allow-Origin: *)
Success200 OK

Behaviour​

  1. Parses JSON; validates userName / authKey.
  2. InvoiceOriginal invoiceOriginal = gson.fromJson(jsonObject.get("invoiceOriginalData"), InvoiceOriginal.class).
  3. reverted = invoiceService.revertFromSIDrafts(invoiceOriginal, tenantId).
  4. If reverted, activity log: draft reverted for invoiceOriginal.getInvoiceNumber().

Response​

Code: 200 OK

Body (JSON string):

{"reverted":true}

or

{"reverted":false}

Headers: Access-Control-Allow-Origin: *


Example Request​

POST /rest/invoicehome/revertSIDrafts HTTP/1.1
Host: {base}
Content-Type: application/json

{
"userId": "42",
"userName": "alice",
"authKey": "secretKey",
"invoiceOriginalData": {
"invoiceNumber": "DRAFT-SI-001",
"customerId": "CUST01",
"...": "other InvoiceOriginal fields as required by service"
}
}