Invoices

The External API (XAPI) provides two method types for adding or modifying invoice-related data - single-transaction, and independent-transaction.

Single-Transaction

The single-transaction endpoints provide a single method for submitting all of the necessary data to create an invoice in one call. To accomplish this, the endpoint accepts a special type of payload that allows the user to set both the invoice header and all of the child tables in a single JSON payload.

The single-transaction type of method has the following behaviors:

  • Atomicity: Invoice additions are prevented (rolled back) if any of the child tables fail in their ability to meet integrity checks or encounter an unexpected error.
  • Speed: Reducing the number of calls to the API results in using a single authentication check rather than several, as well as it makes use of a shared database connection to ensure the fastest possible database performance is achieved.

Independent Transactions

The independent-transaction endpoints allow for the creation or modification of an invoice in small isolated transactions. For example, one endpoint could be used to create an invoice header, and another endpoint could be used to add each item or miscellaneous charge. This style of interacting with an invoice is best suited for situations when individual parts of an existing invoice need to be modified.

The single-transaction type of method has the following behaviours:

  • Flexibility: This type of endpoint allows for the individual addition or modification of any of the individual invoice components. This is useful for situations where the invoice exists and additional information such as comments needs to be added.
  • Reduced Speed: Each invoice components' web method validates the session, establishes a database connection, and initializes any objects; all of which takes time.

Object Design

The following objects and matching endpoints are available.

Object Description Endpoint
Invoice Invoice header table api/v1/invoicing/invoice/add
api/v1/invoicing/invoice/add/getrequest
api/v1/invoicing/invoice/getschema
InvoiceAddress InvoiceAddress table
InvoiceNote InvoiceNote table
InvoiceModel InvoiceModel table api/v1/invoicing/invoice/model/add
InvoiceSerial InvoiceSerial table
InvoiceTax InvoiceTax table
InvoiceItem InvoiceItem table api/v1/invoicing/invoice/item/add
InvoicePackage InvoicePackage table api/v1/invoicing/invoice/package/add
InvoiceTable1 InvoiceTable1 table
InvoiceTable2 InvoiceTable2 table
InvoiceMisc InvoiceMisc table api/v1/invoicing/invoice/misc/add
api/v1/invoicing/invoice/misc/add/getrequest
api/v1/invoicing/invoice/misc/getschema
InvoiceWarranty InvoiceWarranty table api/v1/invoicing/invoice/warranty/add
InvoiceLabor InvoiceLabor table api/v1/invoicing/invoice/labor/add
InvoiceComment InvoiceComment table api/v1/invoicing/invoice/comment/add
api/v1/invoicing/invoice/comment/add/getrequest
api/v1/invoicing/invoice/comment/getschema
InvoicePayment InvoicePayment table api/v1/invoicing/invoice/payment/add
api/v1/invoicing/invoice/payment/add/getrequest
api/v1/invoicing/invoice/payment/getschema