API Reference
API Reference

To add an order to a store, first instantiate a new Client object with the ShippingEasy account's API key and API secret. Then use CreateOrder to specify the store's API key and the data for the order:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ShippingEasy;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            String baseUrl = "https://app.shippingeasy.com";

            // from Settings > API Credentials
            String apiKey = "7e419816e705d1cd6d7d533bf484ad";
            String apiSecret = "3ca2e94bca001112f3a89e208dec55e89d630bbd33a0dcf591847cc5944d21";

            // from Settings > Stores
            String storeApiKey = "d0e8e360d4a1d42a53eed5439150a8";

            var client = new Client(apiKey, apiSecret, baseUrl);

            var result = client.CreateOrder(storeApiKey, new Order
                {
                    ExternalOrderIdentifier = "ABC1234",
                    OrderedAt = DateTime.Now,
                    Recipients =
                    {
                        new Recipient
                        {
                            FirstName = "Colin",
                            LastName = "Smith",
                            Address = "1600 Pennsylvania Ave",
                            City = "Washington",
                            State = "DC",
                            LineItems = {
                                new LineItem { ItemName = "Sprocket", Quantity = 7 }
                            }
                        }
                    },
                });
            HttpResponse response = result.HttpResponse;
        }
    }
}

If successful the call will return a JSON hash with the ShippingEasy order ID, as well as the external order identifier originally supplied in your call:

{
  "order": {
    "id": 58763481,
    "external_order_identifier": "ABC12345",
    "ext_order_reference_id": "ABC12345",
    "owner_id": 50385,
    "ordered_at": "2016-09-16T20:52:13Z",
    "order_status": "ready_for_shipment",
    "parent_order_id": null,
    "source_order_ids": null,
    "total_including_tax": "0.00",
    "total_excluding_tax": "0.00",
    "discount_amount": "0.00",
    "coupon_discount": "0.00",
    "subtotal_including_tax": "0.00",
    "subtotal_excluding_tax": "0.00",
    "subtotal_tax": "0.00",
    "total_tax": "0.00",
    "base_shipping_cost": "0.00",
    "shipping_cost_including_tax": "0.00",
    "shipping_cost_excluding_tax": "0.00",
    "shipping_cost_tax": "0.00",
    "base_handling_cost": "0.00",
    "handling_cost_excluding_tax": "0.00",
    "handling_cost_including_tax": "0.00",
    "handling_cost_tax": "0.00",
    "base_wrapping_cost": "0.00",
    "wrapping_cost_excluding_tax": "0.00",
    "wrapping_cost_including_tax": "0.00",
    "wrapping_cost_tax": "0.00",
    "billing_company": null,
    "billing_first_name": null,
    "billing_last_name": null,
    "billing_address": null,
    "billing_address2": null,
    "billing_city": null,
    "billing_state": null,
    "billing_country": null,
    "billing_postal_code": null,
    "billing_phone_number": null,
    "billing_email": null,
    "recipients": [
      {
        "company": null,
        "first_name": "Colin",
        "last_name": "Smith",
        "address": "1600 Pennsylvania Ave",
        "address2": null,
        "address3": null,
        "city": "Washington",
        "residential": null,
        "state": "DC",
        "province": null,
        "country": "United States",
        "postal_code": null,
        "postal_code_plus_4": null,
        "phone_number": null,
        "email": null,
        "base_cost": "0.00",
        "cost_excluding_tax": "0.00",
        "cost_including_tax": "0.00",
        "cost_tax": "0.00",
        "base_handling_cost": "0.00",
        "handling_cost_excluding_tax": "0.00",
        "handling_cost_including_tax": "0.00",
        "handling_cost_tax": "0.00",
        "shipping_zone_id": null,
        "shipping_zone_name": null,
        "items_total": 0,
        "shipping_method": null,
        "items_shipped": 0,
        "ext_shipping_detail_id": null,
        "line_items": [
          {
            "item_name": "Sprocket",
            "sku": null,
            "bin_picking_number": null,
            "bundled_product": null,
            "weight_in_ounces": "0.0",
            "quantity": 7,
            "total_excluding_tax": "0.00",
            "price_excluding_tax": "0.00",
            "unit_price": "0.00",
            "ext_line_item_id": null,
            "ext_product_id": null,
            "product_options": null,
            "uuid": "70e9f2c7-7433-4ea2-8fcc-a3bb855b0298",
            "order_source_id": 46993771,
            "gift_message": null
          }
        ],
        "original_order": {
          "id": 58763481,
          "customer_id": 3633,
          "store_id": 52377,
          "order_detail_id": 58842251,
          "workflow_state": "ready_for_shipment",
          "shipment_id": null,
          "destination_id": null,
          "split_from_order_id": null,
          "total_weight_in_ounces": "0.0",
          "total_quantity": 7,
          "is_international": false,
          "usps_shipping_zone": null,
          "created_at": "2016-09-16T20:52:11Z",
          "updated_at": "2016-09-16T20:52:11Z",
          "ext_shipment_confirmation_id": null,
          "store_order_status": "awaiting_shipment",
          "drop_ship_tracking_number": null,
          "category_id": null,
          "internal_notes": "",
          "line_item_name": "sprocket",
          "line_item_sku": null,
          "address_kind": "F",
          "recipient_last_name": "smith",
          "recipient_requested_service": null,
          "gift": false,
          "prime_order_id": 58763481,
          "state": "DC",
          "owner_id": 50385,
          "denormalized_ordered_at": "2016-09-16T20:52:13Z",
          "grab_bag": {
            
          },
          "line_item_bin_picking_number": null,
          "denormalized_ext_order_id": "ABC12345",
          "packing_slip_generated": null,
          "denormalized_ext_order_reference_id": "ABC12345",
          "denormalized_alternate_order_id": null,
          "denormalized_sales_channel": null,
          "custom_1": null,
          "custom_2": null,
          "custom_3": null
        }
      }
    ],
    "store_api_key": "d0e8e360d4a1d42a53eed5439150a881",
    "shipments": [
      
    ],
    "updated_at": "2016-09-16T20:52:11Z",
    "internal_notes": "",
    "meta_data": null,
    "prime_order_id": 58763481,
    "is_prime": null,
    "split_from_order_id": null
  }
}

Possible Exceptions

ShippingEasy_AuthenticationError

Your credentials could not be authenticated.

ShippingEasy_InvalidRequestError

The order could not be created on the server for one or more of the following reasons:

  • The JSON payload could not be parsed.
  • One or more of the supplied data attributes failed validation and is missing or incorrect.
  • An order with the supplied external_order_identifier already exists for that store.

The exception will contain a message that indicates which of these conditions failed.