Loading...
Area: Optimizely Service API
Applies to versions: 4 and higher
Other versions:

Warehouses

Recommended reading 

This topic describes how to work with RESTful operations for warehouses in the Optimizely Service API.

In this topic

Example models

[Serializable]
public class Warehouse
  {
    public string Name { get; set; }
    public bool IsActive { get; set; }
    public bool IsPrimary { get; set; }
    public int SortOrder { get; set; }
    public string Code { get; set; }
    public int FulfillmentPriorityOrder { get; set; }
    public bool IsFulfillmentCenter { get; set; }
    public bool IsPickupLocation { get; set; }
    public bool IsDeliveryLocation { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public string Organization { get; set; }
    public string Line1 { get; set; }
    public string Line2 { get; set; }
    public string City { get; set; }
    public string State { get; set; }
    public string CountryCode { get; set; }
    public string CountryName { get; set; }
    public string PostalCode { get; set; }
    public string RegionCode { get; set; }
    public string RegionName { get; set; }
    public string DaytimePhoneNumber { get; set; }
    public string EveningPhoneNumber { get; set; }
    public string FaxNumber { get; set; }
    public string Email { get; set; }
  }

Get all warehouses

get/episerverapi/commerce/warehouses

JSON response type

C# code sample

var client = new HttpClient()
  {
    BaseAddress = new Uri(ConfigurationManager.AppSettings["integrationUrl"])
  };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);		
var result = client.GetAsync("/episerverapi/commerce/warehouses").Result.Content.ReadAsStringAsync().Result

XML response types

Get a specific warehouse

get/episerverapi/commerce/warehouses/{warehouseCode}

JSON response type

C# code sample

var client = new HttpClient()
  {
    BaseAddress = new Uri(ConfigurationManager.AppSettings["integrationUrl"])
  };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);		
var result = client.GetAsync("/episerverapi/commerce/warehouses/{code}").Result.Content.ReadAsStringAsync().Result

XML response type

Create warehouse

post/episerverapi/commerce/warehouses

JSON response type

C# code sample

var model = new Warehouse()
  {
    City = "City",
    Code = "Warehouse 3",
    CountryCode = "CountryCode",
    CountryName = "CountryName",
    DaytimePhoneNumber = "DaytimePhoneNumber",
    Email = "Email",
    EveningPhoneNumber = "EveningPhoneNumber",
    FaxNumber = "FaxNumber",
    FirstName = "FirstName",
    FulfillmentPriorityOrder = 0,
    IsActive = true,
    IsDeliveryLocation = true,
    IsFulfillmentCenter = false,
    IsPickupLocation = false,
    IsPrimary = false,
    LastName = "LastName",
    Line1 = "Line1",
    Line2 = "Line2",
    Name = "Name",
    Organization = "Organization",
    PostalCode = "PostalCode",
    RegionCode = "RegionCode",
    RegionName = "RegionName",
    SortOrder = 0,
    State = "State"
  };

var json = JsonConvert.SerializeObject(model);
var client = new HttpClient()
  {
    BaseAddress = new Uri(ConfigurationManager.AppSettings["integrationUrl"])
  };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);    
var result = client.PostAsync("/episerverapi/commerce/warehouses",
  new StringContent(json, Encoding.UTF8, "application/json")).Result.Content.ReadAsStringAsync().Result

XML response type

Update warehouse

put/episerverapi/commerce/warehouses/{warehouseCode}

JSON response type

C# code sample

var model = new Warehouse()
  {
    City = "City",
    Code = "Warehouse 3",
    CountryCode = "CountryCode",
    CountryName = "CountryName",
    DaytimePhoneNumber = "DaytimePhoneNumber",
    Email = "Email",
    EveningPhoneNumber = "EveningPhoneNumber",
    FaxNumber = "FaxNumber",
    FirstName = "FirstName",
    FulfillmentPriorityOrder = 0,
    IsActive = true,
    IsDeliveryLocation = true,
    IsFulfillmentCenter = false,
    IsPickupLocation = false,
    IsPrimary = false,
    LastName = "LastName",
    Line1 = "Line1",
    Line2 = "Line2",
    Name = "Name",
    Organization = "Organization",
    PostalCode = "PostalCode",
    RegionCode = "RegionCode",
    RegionName = "RegionName",
    SortOrder = 0,
    State = "State"
  };
var json = JsonConvert.SerializeObject(model);
var client = new HttpClient()
  {
    BaseAddress = new Uri(ConfigurationManager.AppSettings["integrationUrl"])
  };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);    
var result = client.PutAsync("/episerverapi/commerce/warehouses/{code}",
  new StringContent(json, Encoding.UTF8, "application/json")).Result.Content.ReadAsStringAsync().Result

XML response type

Delete warehouse

delete/episerverapi/commerce/warehouses/{warehouseCode}

JSON response type

C# code sample

var client = new HttpClient()
  {
    BaseAddress = new Uri(ConfigurationManager.AppSettings["integrationUrl"])
  };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);		
var result = client.DeleteAsync("/episerverapi/commerce/warehouses/{code}").Result.Content.ReadAsStringAsync().Result

XML response type

Related topics

Do you find this information helpful? Please log in to provide feedback.

Last updated: Aug 14, 2017

Recommended reading