Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunityDoc feedbackLog In
GitHubNuGetDev CommunityDoc feedback


**HTTP Verb** – GET

**URL** – /api/v1/invoices

**Description** – Return a collection of invoices

**Base** – HandlerBase\<GetInvoiceCollectionParameter, GetInvoiceCollectionResult>

**Handlers** –

OrderHandlerDescription
500GetRealTimeInvoiceCollectionHandlerIf RealTime invoice history is enabled (application settings **RealTimeCallsEnabled** and **Web_UseRealTimeInvoiceHistory**), then this handler executes. If no job definition is found in the **JobDefinition** database table for running real time invoice history, then a **Not Found** error result is returned. If no job definition step parameters are found with a customer number prompt, then a **Not Found** error result is returned. Otherwise, real time integration job is run and invoice results returned.
550GetStoredInvoiceCollectionHandlerIf this is NOT real time, then gets all stored invoices based on **ERP_LookBackDays** application setting and other filter parameters.

<table class="TableStyle-Borders" style="margin-left: 0; margin-right: auto; width: 100%;" data-cellspacing="0"> <thead> <tr class="header TableStyle-Borders-Head-Header1"> <th class="TableStyle-Borders-HeadE-Regular-Header1">Order</th> <th class="TableStyle-Borders-HeadE-Regular-Header1">Handler</th> <th class="TableStyle-Borders-HeadD-Regular-Header1">Description</th> </tr> </thead> <tbody> <tr class="odd TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyE-Regular-Row1">500</td> <td class="TableStyle-Borders-BodyE-Regular-Row1">GetSettings</td> <td class="TableStyle-Borders-BodyD-Regular-Row1">Gets UseRealTimeCalls and ShowErpOrderNumber settings</td> </tr> <tr class="even TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyE-Regular-Row1">600</td> <td class="TableStyle-Borders-BodyE-Regular-Row1">GetRealTimeJobDefinition</td> <td class="TableStyle-Borders-BodyD-Regular-Row1">Gets real time invoice history integration job and sets parameters, if UseRealTimeCalls setting equals "true".</td> </tr> <tr class="odd TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyE-Regular-Row1">700</td> <td class="TableStyle-Borders-BodyE-Regular-Row1">ExecuteRealTimeJob</td> <td class="TableStyle-Borders-BodyD-Regular-Row1">Executes real time invoice history integration job and save result dataset, if UseRealTimeCalls setting equals "true".</td> </tr> <tr class="even TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyE-Regular-Row1">800</td> <td class="TableStyle-Borders-BodyE-Regular-Row1">MapRealTimeDataSet</td> <td class="TableStyle-Borders-BodyD-Regular-Row1">Parses InvoiceHistory and InvoiceHistoryLine dataset's tables and creates InvoiceHistory and InvoiceHistoryLine lists, which are saved as InvoicesQuery property, if UseRealTimeCalls setting equals "true".</td> </tr> <tr class="odd TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyE-Regular-Row1">900</td> <td class="TableStyle-Borders-BodyE-Regular-Row1">GetStoredCollectionQuery</td> <td class="TableStyle-Borders-BodyD-Regular-Row1">Gets all InvoiceHistories with InvoiceHistoryLines, which belong to current customer, and save them to InvoicesQuery, if UseRealTimeCalls setting equals "false".</td> </tr> <tr class="even TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyE-Regular-Row1">1000</td> <td class="TableStyle-Borders-BodyE-Regular-Row1">ApplyFilteringToStoredCollectionQuery</td> <td class="TableStyle-Borders-BodyD-Regular-Row1"><p>Filters the InvoicesQuery, if specified in the parameter and UseRealTimeCalls setting equals "false".</p> if StatusCollection property has any statuses, returns InvoiceHistories if StatusCollection contains their statusif InvoiceNumber property has value, returns InvoiceHistories if their invoice number equals InvoiceNumber propertyif OrderNumber property has value, returns InvoiceHistories if their order number equals OrderNumber propertyif CustomerPO property has value, returns InvoiceHistories if their CustomerPO equals CustomerPO propertyif CustomerSequence property doesn't equal "-1", returns InvoiceHistories if their CustomerSequence equals CustomerSequence property or emptyif ToDate property has value, returns InvoiceHistories if their InvoiceDate less or equals ToDate propertyif FromDate property has value, returns InvoiceHistories if their InvoiceDate more or equals FromDate propertyif ShowOpenOnly property equals "true", returns InvoiceHistories if they are open.</td> </tr> <tr class="odd TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyE-Regular-Row1">1100</td> <td class="TableStyle-Borders-BodyE-Regular-Row1">ApplySort</td> <td class="TableStyle-Borders-BodyD-Regular-Row1">Applies a sort to the InvoicesQuery. The query is sorted using the Sort property on the parameter object (in ascending order).</td> </tr> <tr class="even TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyE-Regular-Row1">1200</td> <td class="TableStyle-Borders-BodyE-Regular-Row1">ApplyPaging</td> <td class="TableStyle-Borders-BodyD-Regular-Row1">Applies paging to the InvoicesQuery. If the PageSize property on the parameter object has a value, the query is paged using the PageSize and Page properties on the parameter object.</td> </tr> <tr class="odd TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyE-Regular-Row1">1300</td> <td class="TableStyle-Borders-BodyE-Regular-Row1">ExecuteQuery</td> <td class="TableStyle-Borders-BodyD-Regular-Row1">Executes the InvoicesQuery after the query has been filtered, sorted, and paged. The result is stored in the InvoiceHistoryCollection property on the result object.</td> </tr> <tr class="even TableStyle-Borders-Body-Row1"> <td class="TableStyle-Borders-BodyB-Regular-Row1">1400</td> <td class="TableStyle-Borders-BodyB-Regular-Row1">CreateGetInvoiceResults</td> <td class="TableStyle-Borders-BodyA-Regular-Row1">If InvoiceHistoryCollection property on the result object has values, they are transformed into a collection of GetInvoiceResults objects using the GetInvoiceHandler handler. The result is stored in the GetInvoiceResults property on the result object.</td> </tr> </tbody> </table>

**HTTP Verb** – GET

**URL** – /api/v1/ invoices/{invoiceId}

**Description** – Return a single invoice record

**Base** – HandlerBase\<GetInvoiceParameter, GetInvoiceResult>

**Handlers** –

OrderHandlerDescription
500GetRealTimeInvoiceHandlerIf RealTime invoice history is enabled (application settings **RealTimeCallsEnabled** and **Web_UseRealTimeInvoiceHistory**), then this handler executes. If no job definition is found in the **JobDefinition** database table for running real time invoice history, then a **Not Found** error result is returned. If no Job Definition step parameters are found with a customer number prompt, then a **Not Found** error result is returned. Otherwise runs real time integration job, if no invoice is found, **InvoiceHistoryServiceInvoiceHistoryNotFlound** error result is returned, otherwise returns found invoice.
550GetStoredInvoiceHandlerIf this is NOT real time, then gets invoice history record based on the invoiceId and customer number. If no invoice is found, then **InvoiceHistoryServiceInvoiceHistoryNotFound** error result is returned.