/
C# SDK Sample: Downloading Orders
C# SDK Sample: Downloading Orders
This tutorial will download a range of orders in a particular stage for a date range. You can adjust the order query and expansion parameters to modify the orders you retrieve and how much information is contained within the order.
Download Orders Example
using System; using com.ultracart.admin.v2.Api; using com.ultracart.admin.v2.Client; using com.ultracart.admin.v2.Model; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { const string simpleKey = "YOUR API KEY HERE"; // TODO: Replace this with your API Key Configuration.Default.ApiKey.Add("x-ultracart-simple-key", simpleKey); // This is required. Search for 'Versioning' on this page: // https://www.ultracart.com/api/#topics.html Configuration.Default.DefaultHeader.Add("X-UltraCart-Api-Version", "2017-03-01"); GetOrders(); Console.Out.WriteLine("DONE - Hit ENTER to exit"); Console.In.ReadLine(); } static void GetOrders() { var api = new OrderApi(); string expand = "summary"; // TODO: Adjust this expansion string to obtain the desired level of detail on your order int limit = 100; int counter = 1; OrderQuery orderQuery = new OrderQuery(); orderQuery.PaymentDateBegin = "2019-01-01T00:00:00.0000000-05:00"; orderQuery.PaymentDateEnd = "2019-09-05T00:00:00.0000000-04:00"; orderQuery.CurrentStage = OrderQuery.CurrentStageEnum.CompletedOrder; OrdersResponse res = null; do { if (res == null) { res = api.GetOrdersByQuery(orderQuery, limit, 0, null, expand); } else { res = api.GetOrdersByQuery(orderQuery, limit, res.Metadata.ResultSet.NextOffset, null, expand); } Console.Out.WriteLine("res.Orders.length = " + res.Orders.Count); foreach (var i in res.Orders) { Console.Out.WriteLine((counter++) + " " + i.OrderId + " status=" + i.CurrentStage); } } while (res.Metadata.ResultSet.More ?? false); } } }
, multiple selections available,
Related content
EDI: Retransmitting order from Rithum (CommerceHub) OrderStream
EDI: Retransmitting order from Rithum (CommerceHub) OrderStream
More like this
Channel Partner API
Channel Partner API
More like this
Channel Partner API - SOAP Guide (Deprecated)
Channel Partner API - SOAP Guide (Deprecated)
More like this
UltraBooks
UltraBooks
More like this
Channel Partner API - REST Guide
Channel Partner API - REST Guide
More like this
Configuring Fulfillment by Amazon FBA
Configuring Fulfillment by Amazon FBA
More like this