Skip to main content

Approve Generated Invoice API

Introduction​

Approves one or more generated invoices by invoice number: collects numbers from the posted InvoiceOriginal array and calls InvoiceService.approveGeneratedInvoiceList(invoiceNumberList, tenantId). On success, writes an activity log (invoice list truncated to 200 characters with ... if longer).

Source: InvoiceHomePageAPI.approveGeneratedInvoice (@Path("approveGeneratedInvoice")).

See also: Invoice Home — all endpoints.


HTTP Endpoint​

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

Request Body (JSON)​

FieldTypeRequiredDescription
userNameStringYesAuth username.
authKeyStringYesAuth key.
branchStringYesParsed; unused after auth.
userIdStringYesActing user for activity log.
invoiceDataArrayYesInvoiceOriginal objects; only invoiceNumber is read for the approval list.

Authentication​

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

Behaviour​

  1. Validates auth.
  2. Deserialises invoiceData to List<InvoiceOriginal>.
  3. Builds invoiceNumberList from each getInvoiceNumber().
  4. approved = invoiceService.approveGeneratedInvoiceList(invoiceNumberList, tenantId).
  5. If approved, activity log with joined invoice numbers (max display length 200).

Response​

Code: 200 OK

Body (JSON string):

{"status":true}

or

{"status":false}

Headers: Access-Control-Allow-Origin: *


Example Request​

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

{
"userName": "alice",
"authKey": "secretKey",
"branch": "default",
"userId": "42",
"invoiceData": [
{ "invoiceNumber": "INV-001", "customerId": "C1" },
{ "invoiceNumber": "INV-002", "customerId": "C2" }
]
}