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

Catalog entry warehouse inventories

Describes how to work with RESTful operations for catalog entry warehouse inventories in the Optimizely Service API.

Example models

[Serializable]
public class WarehouseInventory
  {
    public string CatalogEntryCode { get; set; }
    public string WarehouseCode { get; set; }
    public ResourceLink WarehouseLink { get; set; }
    public decimal InStockQuantity { get; set; }    
    public decimal ReservedQuantity { get; set; }    
    public decimal ReorderMinQuantity { get; set; }
    public decimal PreorderQuantity { get; set; }
    public decimal BackorderQuantity { get; set; }
    public bool AllowBackorder { get; set; }
    public bool AllowPreorder { get; set; }
    public string InventoryStatus { get; set; }
    public DateTime? PreorderAvailabilityDate { get; set; }
    public DateTime? BackorderAvailabilityDate { get; set; }
    public DateTime? PurchaseAvailableDate { get; set; }
  }

Get all entry warehouse inventories

GETget/episerverapi/commerce/entries/{entryCode}/inventoriesGet all entry warehouse inventories

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/entries/{entry code}/inventories").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/entries/{entry code}/inventories").Result.Content.ReadAsStringAsync().Result

Response

<ArrayOfWarehouseInventory xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <WarehouseInventory>
    <CatalogEntryCode>Accessories-Electronics-200WattsAMFMCDReciever-sku</CatalogEntryCode>
    <WarehouseCode>default</WarehouseCode>
    <InStockQuantity>10</InStockQuantity>
    <ReservedQuantity>2</ReservedQuantity>
    <ReorderMinQuantity>3</ReorderMinQuantity>
    <PreorderQuantity>4</PreorderQuantity>
    <BackorderQuantity>6</BackorderQuantity>
    <AllowBackorder>true</AllowBackorder>
    <AllowPreorder>true</AllowPreorder>
    <InventoryStatus>Enabled</InventoryStatus>
    <PreorderAvailabilityDate>2010-09-01T16:00:00Z</PreorderAvailabilityDate>
    <BackorderAvailabilityDate>2020-01-04T02:00:00Z</BackorderAvailabilityDate>
    <PurchaseAvailableDate>2011-02-02T00:00:00Z</PurchaseAvailableDate>
  </WarehouseInventory>
  <WarehouseInventory>
    <CatalogEntryCode>Accessories-Electronics-200WattsAMFMCDReciever-sku</CatalogEntryCode>
    <WarehouseCode>IL</WarehouseCode>
    <InStockQuantity>200</InStockQuantity>
    <ReservedQuantity>5</ReservedQuantity>
    <ReorderMinQuantity>3</ReorderMinQuantity>
    <PreorderQuantity>5</PreorderQuantity>
    <BackorderQuantity>10</BackorderQuantity>
    <AllowBackorder>true</AllowBackorder>
    <AllowPreorder>true</AllowPreorder>
    <InventoryStatus>Enabled</InventoryStatus>
    <PreorderAvailabilityDate>2011-01-01T00:00:00Z</PreorderAvailabilityDate>
    <BackorderAvailabilityDate>2019-09-09T00:00:00Z</BackorderAvailabilityDate>
    <PurchaseAvailableDate>2011-02-02T00:00:00Z</PurchaseAvailableDate>
  </WarehouseInventory>
  <WarehouseInventory>
    <CatalogEntryCode>Accessories-Electronics-200WattsAMFMCDReciever-sku</CatalogEntryCode>
    <WarehouseCode>NY</WarehouseCode>
    <InStockQuantity>200</InStockQuantity>
    <ReservedQuantity>5</ReservedQuantity>
    <ReorderMinQuantity>3</ReorderMinQuantity>
    <PreorderQuantity>5</PreorderQuantity>
    <BackorderQuantity>10</BackorderQuantity>
    <AllowBackorder>true</AllowBackorder>
    <AllowPreorder>true</AllowPreorder>
    <InventoryStatus>Enabled</InventoryStatus>
    <PreorderAvailabilityDate>2011-01-01T00:00:00Z</PreorderAvailabilityDate>
    <BackorderAvailabilityDate>2019-09-09T00:00:00Z</BackorderAvailabilityDate>
    <PurchaseAvailableDate>2011-02-02T00:00:00Z</PurchaseAvailableDate>
  </WarehouseInventory>
</ArrayOfWarehouseInventory>

Get a specific entry warehouse inventory

GETget/episerverapi/commerce/entries/{entryCode}/inventories/{warehouseCode}Get a specific entry warehouse inventory

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/entries/{entry code}/inventories/{warehouse 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/entries/{entry code}/inventories/{warehouse code}").Result.Content.ReadAsStringAsync().Result

Response

<WarehouseInventory xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <CatalogEntryCode>Accessories-Electronics-200WattsAMFMCDReciever-sku</CatalogEntryCode>
  <WarehouseCode>WELLINGTON</WarehouseCode>
  <InStockQuantity>23</InStockQuantity>
  <ReservedQuantity>1</ReservedQuantity>
  <ReorderMinQuantity>1</ReorderMinQuantity>
  <PreorderQuantity>3</PreorderQuantity>
  <BackorderQuantity>2</BackorderQuantity>
  <AllowBackorder>true</AllowBackorder>
  <AllowPreorder>true</AllowPreorder>
  <InventoryStatus>Enabled</InventoryStatus>
  <PreorderAvailabilityDate>2014-08-26T13:27:01.79Z</PreorderAvailabilityDate>
  <BackorderAvailabilityDate>2014-08-26T13:27:01.79Z</BackorderAvailabilityDate>
  <PurchaseAvailableDate>2014-08-26T13:27:01.79Z</PurchaseAvailableDate>
</WarehouseInventory>

Create entry warehouse inventory

POSTpost/episerverapi/commerce/entries/{entryCode}/inventoriesCreate entry warehouse inventory

JSON response type

var model = new WarehouseInventory()
  {
    AllowBackorder = true,
    AllowPreorder = true,
    BackorderAvailabilityDate = DateTime.UtcNow,
    PurchaseAvailableDate = DateTime.UtcNow,
    BackorderQuantity = 2,
    CatalogEntryCode = "Accessories-Electronics-200WattsAMFMCDReciever-sku",
    InStockQuantity = 23,
    InventoryStatus = "Enabled",
    PreorderAvailabilityDate = DateTime.UtcNow,
    PreorderQuantity = 3,
    ReorderMinQuantity = 1,
    ReservedQuantity = 1,
    WarehouseCode = "WELLINGTON"
  };
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/entries/{entry code}/inventories", 
  new StringContent(json, Encoding.UTF8, "application/json")).Result.Content.ReadAsStringAsync().Result

XML response type

var model = new WarehouseInventory()
  {
    AllowBackorder = true,
    AllowPreorder = true,
    BackorderAvailabilityDate = DateTime.UtcNow,
    PurchaseAvailableDate: DateTime.UtcNow,
    BackorderQuantity = 2,
    CatalogEntryCode = "Accessories-Electronics-200WattsAMFMCDReciever-sku",
    InStockQuantity = 23,
    InventoryStatus = "Enabled",
    PreorderAvailabilityDate = DateTime.UtcNow,
    PreorderQuantity = 3,
    ReorderMinQuantity = 1,
    ReservedQuantity = 1,
    WarehouseCode = "WELLINGTON"
  };
var client = new HttpClient()
  {
    BaseAddress = new Uri(ConfigurationManager.AppSettings["integrationUrl"])
  };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);
var serializer = new XmlSerializer(typeof(WarehouseInventory));
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/entries/{entry code}/inventories", 
  new StringContent(xml, Encoding.UTF8, "text/xml")).Result.Content.ReadAsStringAsync().Result

Response

<WarehouseInventory xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <CatalogEntryCode>Accessories-Electronics-200WattsAMFMCDReciever-sku</CatalogEntryCode>
  <WarehouseCode>WELLINGTON</WarehouseCode>
  <InStockQuantity>23</InStockQuantity>
  <ReservedQuantity>1</ReservedQuantity>
  <ReorderMinQuantity>1</ReorderMinQuantity>
  <PreorderQuantity>3</PreorderQuantity>
  <BackorderQuantity>2</BackorderQuantity>
  <AllowBackorder>true</AllowBackorder>
  <AllowPreorder>true</AllowPreorder>
  <InventoryStatus>Enabled</InventoryStatus>
  <PreorderAvailabilityDate>2014-08-27T09:23:51.6912667Z</PreorderAvailabilityDate>
  <BackorderAvailabilityDate>2014-08-27T09:23:51.6912667Z</BackorderAvailabilityDate>
  <PurchaseAvailableDate>2014-08-27T09:23:51.6912667Z</PurchaseAvailableDate>
</WarehouseInventory>

Update entry warehouse inventory

PUTput/episerverapi/commerce/entries/{entryCode}/inventories/{warehouseCode}Update entry warehouse inventory

JSON response type

var model = new WarehouseInventory()
  {
    AllowBackorder = true,
    AllowPreorder = true,
    BackorderAvailabilityDate = DateTime.UtcNow,
    PurchaseAvailableDate = DateTime.UtcNow,
    BackorderQuantity = 2,
    CatalogEntryCode = "Accessories-Electronics-200WattsAMFMCDReciever-sku",
    InStockQuantity = 23,
    InventoryStatus = "Enabled",
    PreorderAvailabilityDate = DateTime.UtcNow,
    PreorderQuantity = 3,
    ReorderMinQuantity = 1,
    ReservedQuantity = 1,
    WarehouseCode = "WELLINGTON"
  };
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/entries/{entry code}/inventories/{warehouse code}",
  new StringContent(json, Encoding.UTF8, "application/json")).Result.Content.ReadAsStringAsync().Result

XML response type

var model = new WarehouseInventory()
  {
    AllowBackorder = true,
    AllowPreorder = true,
    BackorderAvailabilityDate = DateTime.UtcNow,
    PurchaseAvailableDate = DateTime.UtcNow,
    BackorderQuantity = 2,
    CatalogEntryCode = "Accessories-Electronics-200WattsAMFMCDReciever-sku",
    InStockQuantity = 23,
    InventoryStatus = "Enabled",
    PreorderAvailabilityDate = DateTime.UtcNow,
    PreorderQuantity = 3,
    ReorderMinQuantity = 1,
    ReservedQuantity = 1,
    WarehouseCode = "WELLINGTON"
  };
var client = new HttpClient()
  {
    BaseAddress = new Uri(ConfigurationManager.AppSettings["integrationUrl"])
  };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);
var serializer = new XmlSerializer(typeof(WarehouseInventory));
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/entries/{entry code}/inventories/{warehouse code}",
  new StringContent(xml, Encoding.UTF8, "text/xml")).Result.Content.ReadAsStringAsync().Result

Response

204 No Content

Delete entry warehouse inventory

DELETEdelete/episerverapi/commerce/entries/{entryCode}/inventories/{warehouseCode}Delete entry warehouse inventory

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/entries/{entry code}/inventories/{warehouse 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/entries/{entry code}/inventories/{warehouse code}").Result.Content.ReadAsStringAsync().Result

Response

<WarehouseInventory xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <CatalogEntryCode>Accessories-Electronics-200WattsAMFMCDReciever-sku</CatalogEntryCode>
  <WarehouseCode>WELLINGTON</WarehouseCode>
  <InStockQuantity>23</InStockQuantity>
  <ReservedQuantity>1</ReservedQuantity>
  <ReorderMinQuantity>1</ReorderMinQuantity>
  <PreorderQuantity>3</PreorderQuantity>
  <BackorderQuantity>2</BackorderQuantity>
  <AllowBackorder>true</AllowBackorder>
  <AllowPreorder>true</AllowPreorder>
  <InventoryStatus>Enabled</InventoryStatus>
  <PreorderAvailabilityDate>2014-08-27T09:23:51.6912667Z</PreorderAvailabilityDate>
  <BackorderAvailabilityDate>2014-08-27T09:23:51.6912667Z</BackorderAvailabilityDate>
  <PurchaseAvailableDate>2014-08-27T09:23:51.6912667Z</PurchaseAvailableDate>
</WarehouseInventory>

Special strings

These properties require special values to function properly.

InventoryStatus

  • Enabled
  • Disabled
  • Ignored