Installation

Install via nuget. From within Visual Studo, right-click on the your Project and choose Manage NuGet packages. Search for "ShippingEasy".

Alternatively, you can install the package using the NuGet Package Manager Console (available from VS Tools menu):

PM> Install-Package ShippingEasy

Or, you can download a .zip file with the binaries from: https://github.com/ShippingEasy/shipping_easy-dotnet/releases/

Configuration

You will need a ShippingEasy API key and secret to sign your API requests. These can be found in your account's settings (https://app.shippingeasy.com/settings/api_credentials).

Example

Once you have the credentials, you can use them to create an instance of the ShippingEasy.Client. The Client has methods to retrieve and create orders. The following is an example program that will download orders from your ShippingEasy account:

using System;

namespace demo
{
  class Program
  {
    static void Main(string[] args)
    {
      // These values should be loaded from a configuration file.
      string apiKey = "f9a7c8ebdfd34beaf260d9b0296c7058";
      string apiSecret = "850fd4e023478758360b0d1d1817448f0a57b3176be25ffe8a7cf2236eca9ec4";

      var client = new ShippingEasy.Client(apiKey, apiSecret);
      var query = new ShippingEasy.OrderQuery {
        Status = "ready_for_shipment, shipped"
      }
      var response = client.GetOrders(query);
      if (response.Success)
      {
        foreach (var order in response.Orders)
        {
          Console.WriteLine("{0} {1} {2} {3}",
            order.OrderedAt,
            order.ExternalOrderIdentifier,
            order.Recipients[0].LastName,
            order.OrderStatus);
        }
      }
      else
      {
        Console.WriteLine(response.Errors);
      }
    }
  }
}