HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideGitHubNuGetDev CommunitySubmit a ticketLog In
GitHubNuGetDev CommunitySubmit a ticket

Warehouses

Describes how to work with RESTful operations for warehouses in the Optimizely Service API.

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

GETget/episerverapi/commerce/warehousesGet all warehouses

JSON response type

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

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

Response

<ArrayOfWarehouse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Warehouse>
    <Name>Default Warehouse</Name>
    <IsActive>true</IsActive>
    <IsPrimary>true</IsPrimary>
    <SortOrder>0</SortOrder>
    <Code>default</Code>
    <FulfillmentPriorityOrder>0</FulfillmentPriorityOrder>
    <IsFulfillmentCenter>true</IsFulfillmentCenter>
    <IsPickupLocation>true</IsPickupLocation>
    <IsDeliveryLocation>false</IsDeliveryLocation>
    <FirstName>James</FirstName>
    <LastName>Mary</LastName>
    <Organization />
    <Line1>123 Default Street</Line1>
    <Line2 />
    <City>Los Angeles</City>
    <State>California</State>
    <CountryCode>USA</CountryCode>
    <CountryName>United States</CountryName>
    <PostalCode>90210</PostalCode>
    <RegionCode />
    <RegionName>California</RegionName>
    <DaytimePhoneNumber />
    <EveningPhoneNumber />
    <FaxNumber />
    <Email>[email protected]</Email>
  </Warehouse>
  <Warehouse>
    <Name>Bangkok store</Name>
    <IsActive>true</IsActive>
    <IsPrimary>true</IsPrimary>
    <SortOrder>0</SortOrder>
    <Code>BANGKOK</Code>
    <FulfillmentPriorityOrder>0</FulfillmentPriorityOrder>
    <IsFulfillmentCenter>false</IsFulfillmentCenter>
    <IsPickupLocation>true</IsPickupLocation>
    <IsDeliveryLocation>true</IsDeliveryLocation>
    <FirstName>Aaron</FirstName>
    <LastName>Goldfinch</LastName>
    <Organization />
    <Line1>70 Saggers Road</Line1>
    <Line2 />
    <City>NAIRIBIN</City>
    <State>Siam</State>
    <CountryCode>TH</CountryCode>
    <CountryName>Thailand</CountryName>
    <PostalCode>6350</PostalCode>
    <RegionCode />
    <RegionName>Flat Defeat of Siam</RegionName>
    <DaytimePhoneNumber />
    <EveningPhoneNumber />
    <FaxNumber />
    <Email>[email protected]</Email>
  </Warehouse>
</ArrayOfWarehouse>

Get a specific warehouse

GETget/episerverapi/commerce/warehouses/{warehouseCode}Get a specific warehouse

JSON response type

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

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

Response

<Warehouse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Name>Wellington store</Name>
  <IsActive>true</IsActive>
  <IsPrimary>true</IsPrimary>
  <SortOrder>0</SortOrder>
  <Code>WELLINGTON</Code>
  <FulfillmentPriorityOrder>0</FulfillmentPriorityOrder>
  <IsFulfillmentCenter>false</IsFulfillmentCenter>
  <IsPickupLocation>true</IsPickupLocation>
  <IsDeliveryLocation>true</IsDeliveryLocation>
  <FirstName>Ã…non</FirstName>
  <LastName>Vie</LastName>
  <Organization />
  <Line1>226 Tulsa Grove</Line1>
  <Line2 />
  <City>Clouston Park</City>
  <State>Upper Hutt</State>
  <CountryCode>NZ</CountryCode>
  <CountryName>New Zealand</CountryName>
  <PostalCode>5018</PostalCode>
  <RegionCode />
  <RegionName>Kapiti</RegionName>
  <DaytimePhoneNumber />
  <EveningPhoneNumber />
  <FaxNumber />
  <Email>[email protected]</Email>
</Warehouse>

Create warehouse

POSTpost/episerverapi/commerce/warehousesCreate warehouse

JSON response type

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

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 client = new HttpClient()
  {
    BaseAddress = new Uri(ConfigurationManager.AppSettings["integrationUrl"])
  };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);
var serializer = new XmlSerializer(typeof(Warehouse));
var xml = String.Empty;
using (var ms = new MemoryStream())
  {
    serializer.Serialize(ms, model);
    xml = Encoding.Default.GetString(ms.ToArray());
  } 
var result = client.PostAsync("/episerverapi/commerce/warehouses",
  new StringContent(xml, Encoding.UTF8, "text/xml")).Result.Content.ReadAsStringAsync().Result

Response

<Warehouse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Name>Wellington store</Name>
  <IsActive>true</IsActive>
  <IsPrimary>true</IsPrimary>
  <SortOrder>0</SortOrder>
  <Code>WELLINGTON</Code>
  <FulfillmentPriorityOrder>0</FulfillmentPriorityOrder>
  <IsFulfillmentCenter>false</IsFulfillmentCenter>
  <IsPickupLocation>true</IsPickupLocation>
  <IsDeliveryLocation>true</IsDeliveryLocation>
  <FirstName>Ã…non</FirstName>
  <LastName>Vie</LastName>
  <Organization />
  <Line1>226 Tulsa Grove</Line1>
  <Line2 />
  <City>Clouston Park</City>
  <State>Upper Hutt</State>
  <CountryCode>NZ</CountryCode>
  <CountryName>New Zealand</CountryName>
  <PostalCode>5018</PostalCode>
  <RegionCode />
  <RegionName>Kapiti</RegionName>
  <DaytimePhoneNumber />
  <EveningPhoneNumber />
  <FaxNumber />
  <Email>[email protected]</Email>
</Warehouse>

Update warehouse

PUTput/episerverapi/commerce/warehouses/{warehouseCode}Update warehouse

JSON response type

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

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 client = new HttpClient()
  {
    BaseAddress = new Uri(ConfigurationManager.AppSettings["integrationUrl"])
  };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);
var serializer = new XmlSerializer(typeof(Warehouse));
var xml = String.Empty;
using (var ms = new MemoryStream())
  {
    serializer.Serialize(ms, model);
    xml = Encoding.Default.GetString(ms.ToArray());
  }   
var result = client.PutAsync("/episerverapi/commerce/warehouses/{code}",
  new StringContent(xml, Encoding.UTF8, "text/xml")).Result.Content.ReadAsStringAsync().Result

Response

200 No Content

Delete warehouse

DELETEdelete/episerverapi/commerce/warehouses/{warehouseCode}Delete warehouse

JSON response type

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

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

Response

<Warehouse xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Name>Wellington store</Name>
  <IsActive>true</IsActive>
  <IsPrimary>true</IsPrimary>
  <SortOrder>0</SortOrder>
  <Code>WELLINGTON</Code>
  <FulfillmentPriorityOrder>0</FulfillmentPriorityOrder>
  <IsFulfillmentCenter>false</IsFulfillmentCenter>
  <IsPickupLocation>true</IsPickupLocation>
  <IsDeliveryLocation>true</IsDeliveryLocation>
  <FirstName>Ã…non</FirstName>
  <LastName>Vie</LastName>
  <Organization />
  <Line1>226 Tulsa Grove</Line1>
  <Line2 />
  <City>Clouston Park</City>
  <State>Upper Hutt</State>
  <CountryCode>NZ</CountryCode>
  <CountryName>New Zealand</CountryName>
  <PostalCode>5018</PostalCode>
  <RegionCode />
  <RegionName>Kapiti</RegionName>
  <DaytimePhoneNumber />
  <EveningPhoneNumber />
  <FaxNumber />
  <Email>[email protected]</Email>
</Warehouse>