This topic describes how to work with RESTful operations for catalog entry warehouse inventories in the Episerver Service API.
In this topic
- Special strings
- Example models
- Get all entry warehouse inventories
- Get entry warehouse inventory
- Post entry warehouse inventory
- Put entry warehouse inventory
- Delete entry warehouse inventory
Special strings
These properties require special values to function properly.
InventoryStatus
- Enabled
- Disabled
- Ignored
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
/episerverapi/commerce/entries/{entry code}/inventories
Client Code Media Type JSON
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
Response JSON
[
{
"CatalogEntryCode" : "Accessories-Electronics-200WattsAMFMCDReciever-sku",
"WarehouseCode" : "default",
"WarehouseLink" : null,
"InStockQuantity" : 10.0,
"ReservedQuantity" : 2.0,
"ReorderMinQuantity" : 3.0,
"PreorderQuantity" : 4.0,
"BackorderQuantity" : 6.0,
"AllowBackorder" : true,
"AllowPreorder" : true,
"InventoryStatus" : "Enabled",
"PreorderAvailabilityDate" : "2010-09-01T16:00:00Z",
"BackorderAvailabilityDate" : "2020-01-04T02:00:00Z",
"PurchaseAvailableDate" : "2011-02-02T00:00:00Z"
},
{
"CatalogEntryCode" : "Accessories-Electronics-200WattsAMFMCDReciever-sku",
"WarehouseCode" : "IL",
"WarehouseLink" : null,
"InStockQuantity" : 200.0,
"ReservedQuantity" : 5.0,
"ReorderMinQuantity" : 3.0,
"PreorderQuantity" : 5.0,
"BackorderQuantity" : 10.0,
"AllowBackorder" : true,
"AllowPreorder" : true,
"InventoryStatus" : "Enabled",
"PreorderAvailabilityDate" : "2011-01-01T00:00:00Z",
"BackorderAvailabilityDate" : "2019-09-09T00:00:00Z",
"PurchaseAvailableDate" : "2011-02-02T00:00:00Z"
},
{
"CatalogEntryCode" : "Accessories-Electronics-200WattsAMFMCDReciever-sku",
"WarehouseCode" : "NY",
"WarehouseLink" : null,
"InStockQuantity" : 200.0,
"ReservedQuantity" : 5.0,
"ReorderMinQuantity" : 3.0,
"PreorderQuantity" : 5.0,
"BackorderQuantity" : 10.0,
"AllowBackorder" : true,
"AllowPreorder" : true,
"InventoryStatus" : "Enabled",
"PreorderAvailabilityDate" : "2011-01-01T00:00:00Z",
"BackorderAvailabilityDate" : "2019-09-09T00:00:00Z",
"PurchaseAvailableDate" : "2011-02-02T00:00:00Z"
}
]
Client Code Media Type XML
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 XML
<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 Entry Warehouse Inventory
/episerverapi/commerce/entries/{entry code}/inventories/{warehouse code}
Client Code Media Type JSON
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
Response JSON
{
"CatalogEntryCode" : "Accessories-Electronics-200WattsAMFMCDReciever-sku",
"WarehouseCode" : "WELLINGTON",
"WarehouseLink" : null,
"InStockQuantity" : 23.0,
"ReservedQuantity" : 1.0,
"ReorderMinQuantity" : 1.0,
"PreorderQuantity" : 3.0,
"BackorderQuantity" : 2.0,
"AllowBackorder" : true,
"AllowPreorder" : true,
"InventoryStatus" : "Enabled",
"PreorderAvailabilityDate" : "2014-08-26T13:27:01.79Z",
"BackorderAvailabilityDate" : "2014-08-26T13:27:01.79Z"
"PurchaseAvailableDate" : "2014-08-26T13:27:01.79Z"
}
Client Code Media Type XML
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 XML
<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>
Post Entry Warehouse Inventory
/episerverapi/commerce/entries/{entry code}/inventories
Client Code Media Type JSON
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
Response JSON
{
"CatalogEntryCode" : "Accessories-Electronics-200WattsAMFMCDReciever-sku",
"WarehouseCode" : "WELLINGTON",
"WarehouseLink" : null,
"InStockQuantity" : 23.0,
"ReservedQuantity" : 1.0,
"ReorderMinQuantity" : 1.0,
"PreorderQuantity" : 3.0,
"BackorderQuantity" : 2.0,
"AllowBackorder" : true,
"AllowPreorder" : true,
"InventoryStatus" : "Enabled",
"PreorderAvailabilityDate" : "2014-08-27T09:23:51.6912667Z",
"BackorderAvailabilityDate" : "2014-08-27T09:23:51.6912667Z",
"PurchaseAvailableDate" : "2014-08-27T09:23:51.6912667Z"
}
Client Code Media Type XML
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 XML
<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>
Put Entry Warehouse Inventory
/episerverapi/commerce/entries/{entry code}/inventories/{warehouse code}
Client Code Media Type JSON
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
Response JSON
204 No Content
Client Code Media Type XML
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 XML
204 No Content
Delete Entry Warehouse Inventory
/episerverapi/commerce/entries/{entry code}/inventories/{warehouse code}
Client Code Media Type JSON
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
Response JSON
{
"CatalogEntryCode" : "Accessories-Electronics-200WattsAMFMCDReciever-sku",
"WarehouseCode" : "WELLINGTON",
"WarehouseLink" : null,
"InStockQuantity" : 23.0,
"ReservedQuantity" : 1.0,
"ReorderMinQuantity" : 1.0,
"PreorderQuantity" : 3.0,
"BackorderQuantity" : 2.0,
"AllowBackorder" : true,
"AllowPreorder" : true,
"InventoryStatus" : "Enabled",
"PreorderAvailabilityDate" : "2014-08-27T09:23:51.6912667Z",
"BackorderAvailabilityDate" : "2014-08-27T09:23:51.6912667Z",
"PurchaseAvailableDate" : "2014-08-27T09:23:51.6912667Z"
}
Client Code Media Type XML
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 XML
<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>
Related topics
Do you find this information helpful? Please log in to provide feedback.
Last updated: Aug 14, 2017