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

Catalog entry warehouse inventories

Recommended reading 

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

In this topic

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

get/episerverapi/commerce/entries/{entryCode}/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

Get a specific entry warehouse inventory

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

XML response type

Create entry warehouse inventory

post/episerverapi/commerce/entries/{entryCode}/inventories

JSON response type

C# code sample

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

Update entry warehouse inventory

put/episerverapi/commerce/entries/{entryCode}/inventories/{warehouseCode}

JSON response type

C# code sample

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

Delete entry warehouse inventory

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

XML response type

Special strings

These properties require special values to function properly.

InventoryStatus

  • Enabled
  • Disabled
  • Ignored

Related topics

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

Last updated: Aug 14, 2017

Recommended reading