-
Notifications
You must be signed in to change notification settings - Fork 2
GetOrdersBy
Leandro Rowies edited this page Jun 1, 2023
·
9 revisions
The GetOrdersBy
method returns a the list of Orders which match the query parameter supplied.
Careful, this method doesn't implement paging when returning the data. It's strongly reccomended that you use GetOrdersByPaged instead.
Parameter | Type | Description |
---|---|---|
token | String | The session token retrieved during authentication. |
query | WSGetOrdersByQuery | This contains the filter and details of your query. |
The query itself follows this structure WSGetOrdersByQuery
with the following members:
Name | Type | Description | Mandatory |
---|---|---|---|
FromDate | DateTime | Any Order must have a Transaction Date after to this date if given (inclusive). | Yes |
ToDate | DateTime | Any Order must have a Transaction Date before to this date if given (inclusive). | Yes |
FromCreationDate | DateTime | Any Order created after this date (inclusive). | Yes |
ToCreationDate | DateTime | Any Order created before this date (inclusive). | Yes |
Skip | int | Number of records to skip | No |
AccountIDsFilter | Int32[] | Limits the result set to orders linked to the account IDs (customer or supplier IDs). | No |
DepartmentIDsFilter | String[] | Limits the result set to orders having at least one line bearing any of the given department(analysis codes) IDs. | No |
OrderIDsFilter | Int32[] | Limits the result set to orders with the IDs. | No |
Status | String | Limits the result set to orders having the status required, i.e. "Reserved","PartiallyDelivered","FullyDelivered,"Complete","Closed" | No |
Ledger | String | Limits the result set to orders having the Ledger required, i.e. "Sales","Purchases" | No |
OrderNumbers | Array of Strings | Limits results to a set of orders linked the order. Helpful if you only have the Order numbers available. | 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 orders 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 WSGetOrdersByQuery()
{
Status = "Complete",
FromDate = DateTime.Parse("2014-09-1"),
ToDate = DateTime.Parse("2014-09-20")
};
var orders = ws.GetOrdersBy(auth, query);
if( orders.Status == OperationStatus.Success )
{
Console.WriteLine(String.Format("Found {0} orders", orders.Result.Count));
foreach(var order in orders.Result)
{
Console.WriteLine(String.Format("Order [{0}] {1} on the {2} for {3}:", order.OrderID, order.AccountCode, order.CreationDate, order.GrossAmount));
}
}
}