HomeGuides
Submit Documentation FeedbackJoin Developer CommunityLog In

Invoices API handler

This topic describes how to use the invoices API handler to return a collection of invoices.

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.
OrderHandlerDescription
500GetSettingsGets UseRealTimeCalls and ShowErpOrderNumber settings
600GetRealTimeJobDefinitionGets real time invoice history integration job and sets parameters, if UseRealTimeCalls setting equals "true".
700ExecuteRealTimeJobExecutes real time invoice history integration job and save result dataset, if UseRealTimeCalls setting equals "true".
800MapRealTimeDataSetParses InvoiceHistory and InvoiceHistoryLine dataset's tables and creates InvoiceHistory and InvoiceHistoryLine lists, which are saved as InvoicesQuery property, if UseRealTimeCalls setting equals "true".
900GetStoredCollectionQueryGets all InvoiceHistories with InvoiceHistoryLines, which belong to current customer, and save them to InvoicesQuery, if UseRealTimeCalls setting equals "false".
1000ApplyFilteringToStoredCollectionQueryFilters the InvoicesQuery, if specified in the parameter and UseRealTimeCalls setting equals "false".
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.
1100ApplySortApplies a sort to the InvoicesQuery. The query is sorted using the Sort property on the parameter object (in ascending order).
1200ApplyPagingApplies 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.
1300ExecuteQueryExecutes the InvoicesQuery after the query has been filtered, sorted, and paged. The result is stored in the InvoiceHistoryCollection property on the result object.
1400CreateGetInvoiceResultsIf 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.

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.

Did this page help you?