Instructions for use of the API.

For full code examples, see the Shipwire.Tests project in the Solution and run the MS Tests. You will need to populate TestShipwireAccount with a valid Shipwire username, password and product SKU.

Which ever operation you wish to use, you must first create an IShipwireService. This is done as follows:

IShipwireService service = new ShipwireService(Enviroment.Production, Server.Production, "shipwire_username", "shipwire_password");


You may select either the Product or Sandbox enviroment, and the Product or Test servers depending on whether you are creating tests or not.

You can then call operations on the service.

Example Inventory Query:
var result = service.GetInventoryDetails();

This will get a list of all products across all warehouses. Check intellisense for the data returned.

Example Rate Query:
OrderRateRequest request = new OrderRateRequest
    {
        Id = "12579",
        AddressInfo = new AddressInfo
            {
                Address1 = "House of Commons",
                Address2 = "",
                City = "London",
                State = "Greater London",
                Zip = "SW1A 0PW",
                Country = "UK"
            },
        Items = new OrderItem[] { new OrderItem { Code = "PRODUCT-SKU", Quantity = 1, Num = "0" } }
    };

var result = service.GetShippingEstimates(request);

This will return a list of shipping estimates for the requested order. As no warehouse was specified Shipwire will choose the best warehouse for this order. A warehouse can be specified if you wish to override Shipwire's selection. The estimates are driven from the settings in your Shipwire account.

Example Fulfillment Query:
To send a request for a single order, you must create a FulfillmentOrder class which contains all the required information for this order. You can then pass this to the PlaceOrder method which will respond with the result.
FulfillmentOrder order = new FulfillmentOrder
{
    Id = "TEST10",
    CanSplit = false,
    Email = "customer_email@customer_domain.com",
    CompanyName = "My Company",
    Hold = false,
    SameDay = SameDayRequest.NOT_REQUESTED,
    AddressInfo = new AddressInfo
    {
        Address1 = "House of Commons",
        Address2 = "",
        City = "London",
        State = "Greater London",
        Zip = "SW1A 0PW",
        Country = "UK",
        Commercial = false
    },
    Items = new OrderItem[] { new OrderItem { Code = "PRODUCT-SKU", Quantity = 1, Num = "0" } }
};

var response = service.PlaceOrder(order);

The response will return a status. If the status is 0 then the call was successful and the order has been placed. You will now be able to see this order in your Shipwire account.

Last edited Mar 19, 2012 at 11:14 AM by James_Carter, version 7

Comments

No comments yet.