GetInvoicesBy - accountsIQ/API-Wiki GitHub Wiki
The GetInvoicesBy
method returns a the list of transactions matching a set of other filters specified on the query sent in the request.
The maximum number of records returned per call is 1,000 transactions - if your query returns more rows you'll need to use the "Skip" parameter to get the next page of results.
Parameter | Type | Description |
---|---|---|
token | String | The session token retrieved during authentication. |
query | WSGetInvoicesByQuery | This contains the filter and details of your query. |
The query itself follows this structure WSGetInvoicesByQuery
with the following members:
Name | Type | Description | Mandatory |
---|---|---|---|
FromDate | DateTime | Any invoice must have a date after to this date if given (inclusive). | Yes |
ToDate | DateTime | Any invoice must have a date after to this date if given (inclusive). | Yes |
FromCreationDate | DateTime | Any invoice created after this date(inclusive). | Yes |
ToCreationDate | DateTime | Any invoice created before this date(inclusive). | Yes |
Skip | int | Number of records to skip | No |
Limit | int | Limit the amount records returned. This can be used in tandem with Skip to page through results. | No |
TypesFilter | String[] | Limits the result set to invoices with a type in the provided list. "PI", "PN", "SI", "SN" | No |
AccountIDsFilter | Int32[] | Limits the result set to invoices linked to the account IDs (customer or supplier IDs). | No |
DepartmentIDsFilter | String[] | Limits the result set to invoices having at least one line bearing any of the given department IDs. | No |
InvoiceIDsFilter | Int32[] | Limits the result set to invoices with the IDs. | No |
Status | String | Limits the result set to invoices having the status required, i.e. "Posted" | No |
OrderBy | string | Return results in a particular order. Currently only supports Create date. Parameter must be 'creationdate', if you want to order by Creation date, omit otherwise | No |
FromLastModifiedDateInUTC | DateTime | Only return data modified on/after this date in UTC time zone. | No |
Here is an example of a system requesting all invoices created between the 1st of September 2014 and the 20th of September 2014 with status "Posted:
Integration ws = new Integration();
String auth = ws.Login(entityID, partnerKey, userKey);
if( auth != null )
{
var query = new WSGetInvoicesByQuery()
{
Status = "Posted",
FromDate = DateTime.Parse("2014-09-1"),
ToDate = DateTime.Parse("2014-09-20")
};
var invoices = ws.GetInvoicesBy(auth, query);
if( invoices.Status == OperationStatus.Success )
{
Console.WriteLine(String.Format("Found {0} invoices", invoices.Result.Count));
foreach(var invoice in invoices.Result)
{
Console.WriteLine(String.Format("Invoice [{0}] {1} on the {2} for {3}:", invoice.InvoiceID, invoice.AccountCode, invoice.CreationDate, invoice.GrossAmount));
}
}
}