Skip to main content

Delete Invoice Model API

Introduction​

Deletes a single invoice line (InvoiceModel) associated with a draft/generated invoice context. The request supplies both invoiceModel and invoiceData (InvoiceOriginal); the code calls invoiceModel.setInvoiceNumber(invoiceOriginal) before invoking InvoiceService.deleteInvoiceModel with a one-element list.

Source: InvoiceHomePageAPI.deleteInvoiceModel (@Path("invoicehome")).

See also: Invoice Home — all endpoints.


Security note​

No checkIfAuthKeyIsValid — anyone who can reach the endpoint can trigger deletion logic for the tenant inferred from the request.


HTTP Endpoint​

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

Request Body (JSON)​

FieldTypeRequiredDescription
invoiceModelObjectYesGson deserialised to InvoiceModel.
invoiceDataObjectYesGson deserialised to InvoiceOriginal; linked to the model via setInvoiceNumber.

Behaviour​

deleted = invoiceService.deleteInvoiceModel(toDeleteInvoiceModel, false, tenantId) with a singleton list containing the prepared invoiceModel.


Response​

Code: 200 OK

Body (JSON string):

{"deleted":true}

or

{"deleted":false}

Headers: Access-Control-Allow-Origin: *


Example Request​

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

{
"invoiceModel": {
"id": 10,
"...": "line fields"
},
"invoiceData": {
"invoiceNumber": "INV-DRAFT-1",
"customerId": "C1",
"...": "header fields"
}
}