GetTransactionsByExternalReference - accountsIQ/API-Wiki GitHub Wiki
The GetTransactionsByExternalReference
method returns a the list of transactions matching this reference (up to 2000) based on the external reference given and a set of other filters.
Parameter | Type | Description |
---|---|---|
token | String | The session token retrieved during authentication. |
query | WSGetTransactionsByExternalReferenceQuery | This contains the filter and details of your query. |
The query itself follows this structure WSGetTransactionsByExternalReferenceQuery
with the following members:
Name | Type | Description | Mandatory |
---|---|---|---|
ExternalReference | String | The external reference used to find transactions. | Yes |
FromDate | DateTime | Any transaction must have a date after to this date if given (inclusive). | No |
ToDate | DateTime | Any transaction must have a date after to this date if given (inclusive). | No |
TypesFilter | String[] | Limits the result set to transactions with a type in the provided list. See TransactionTypes for the list of all transaction types. | No |
AccountIDsFilter | Int32[] | Limits the result set to transactions linked to the account IDs (customer or supplier IDs). | No |
DepartmentIDsFilter | String[] | Limits the result set to transactions having at least one line bearing any of the given department IDs. | No |
Here is an example of a system requesting all transactions matching the external reference "Direct Debit" made between the 1st of September 2014 and the 20th of September 2014 with at least one of transaction bearing any of "GENERAL", "OFFICE" department IDs:
Integration ws = new Integration();
String auth = ws.Login(entityID, partnerKey, userKey);
if( auth != null )
{
var query = new WSGetTransactionsByExternalReferenceQuery()
{
ExternalReference = "Direct Debit",
FromDate = DateTime.Parse("2014-09-1"),
ToDate = DateTime.Parse("2014-09-20"),
DepartmentIDsFilter = new String[]{ "GENERAL", "OFFICE" }
};
var transactions = ws.GetTransactionsByExternalReference(auth, query);
if( transactions.Status == OperationStatus.Success )
{
Console.WriteLine(String.Format("Found {0} transactions", transactions.Result));
foreach(var transaction in transactions.Result)
{
Console.WriteLine(String.Format("Transaction [{0}] {1} on the {2} for {3}:", transaction.TransactionID, transaction.AccountCode, transaction.TransactionDate, transaction.ControlAmount));
foreach(var line in transaction.LineDetails)
{
Console.WriteLine(String.Format("\t- {0} on {1} with department {2} {3}", line.Amount, line.GLAccountCode, line.DeparmentID, line.IsControlLine ? "[Control]" : line.IsTaxLine ? "[Tax]" : ""));
}
}
}
}