HomeDev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideLegal TermsGitHubNuGetDev CommunityOptimizely AcademySubmit a ticketLog In
Dev Guide

Catalog item assets

Describes how to work with RESTful operations for catalog item assets and catalog node assets in the Optimizely Service API.

Example models

[Serializable]
public class ItemAsset
  {
    public string CatalogNodeCode { get; set; }
    public string CatalogEntryCode { get; set; }
    public string AssetKey { get; set; }
    public string AssetType { get; set; }
    public string GroupName { get; set; }
    public int SortOrder { get; set; }
  }

Entry assets

Get all entry assets

GETget/episerverapi/commerce/entries/{entryCode}/assetsGet all entry assets

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}/assets").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}/assets").Result.Content.ReadAsStringAsync().Result

Response

<ArrayOfItemAsset xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <ItemAsset>
    <CatalogEntryCode>Jackets-Blazers-Wrap</CatalogEntryCode>
    <AssetKey>fd761c1d-5692-48b6-b90a-1ddf4c7c5eb9</AssetKey>
    <AssetType>episerver.core.icontentimage</AssetType>
    <GroupName>large</GroupName>
    <SortOrder>45</SortOrder>
  </ItemAsset>
</ArrayOfItemAsset>

Get a specific entry asset

GETget/episerverapi/commerce/entries/{entryCode}/assets/{assetKey}/{assetType}Get a specific entry asset

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}/assets/{assetKey}/{assetType}").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}/assets/{assetKey}/{assetType}").Result.Content.ReadAsStringAsync().Result

Response

<ItemAsset xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <CatalogEntryCode>Jackets-Blazers-Wrap</CatalogEntryCode>
  <AssetKey>fd761c1d-5692-48b6-b90a-1ddf4c7c5eb9</AssetKey>
  <AssetType>episerver.core.icontentimage</AssetType>
  <GroupName>large</GroupName>
  <SortOrder>45</SortOrder>
</ItemAsset>

Create entry asset

POSTpost/episerverapi/commerce/entries/{entryCode}/assetsCreate entry asset

JSON response type

var model = new ItemAsset() 
  {
    CatalogEntryCode = "Jackets-Blazers-Wrap",
    AssetKey = "fd761c1d-5692-48b6-b90a-1ddf4c7c5eb9",
    AssetType = "episerver.core.icontentimage",
    SortOrder = 45,
    GroupName = "large"
  };
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}/assets",
  new StringContent(json, Encoding.UTF8, "application/json")).Result.Content.ReadAsStringAsync().Result

XML response type

var model = new ItemAsset()
  {
    CatalogEntryCode = "Jackets-Blazers-Wrap",
    AssetKey = "fd761c1d-5692-48b6-b90a-1ddf4c7c5eb9",
    AssetType = "episerver.core.icontentimage",
    SortOrder = 45,
    GroupName = "large"
  };
var client = new HttpClient()
  {
    BaseAddress = new Uri(ConfigurationManager.AppSettings["integrationUrl"])
  };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);
var serializer = new XmlSerializer(typeof(ItemAsset));
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}/assets",
  new StringContent(xml, Encoding.UTF8, "text/xml")).Result.Content.ReadAsStringAsync().Result

Response

<ItemAsset xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <CatalogEntryCode>Jackets-Blazers-Wrap</CatalogEntryCode>
  <AssetKey>fd761c1d-5692-48b6-b90a-1ddf4c7c5eb9</AssetKey>
  <AssetType>episerver.core.icontentimage</AssetType>
  <GroupName>large</GroupName>
  <SortOrder>45</SortOrder>
</ItemAsset>

Update entry asset

PUTput/episerverapi/commerce/entries/{entryCode}/assets/{assetKey}/{assetType}Update entry asset

JSON response type

var model = new ItemAsset()
  {
    CatalogEntryCode = "Jackets-Blazers-Wrap",
    AssetKey = "fd761c1d-5692-48b6-b90a-1ddf4c7c5eb9",
    AssetType = "episerver.core.icontentimage",
    SortOrder = 45,
    GroupName = "large"
  };

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}/assets/{assetKey}/{assetType}",
  new StringContent(json, Encoding.UTF8, "application/json")).Result.Content.ReadAsStringAsync().Result

XML response type

var model = new ItemAsset()
  {
    CatalogEntryCode = "Jackets-Blazers-Wrap",
    AssetKey = "fd761c1d-5692-48b6-b90a-1ddf4c7c5eb9",
    AssetType = "episerver.core.icontentimage",
    SortOrder = 45,
    GroupName = "large"
  };
var client = new HttpClient()
  {
    BaseAddress = new Uri(ConfigurationManager.AppSettings["integrationUrl"])
  };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);
var serializer = new XmlSerializer(typeof(ItemAsset));
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}/assets/{assetKey}/{assetType}",
  new StringContent(xml, Encoding.UTF8, "text/xml")).Result.Content.ReadAsStringAsync().Result

Response

204 No Content

Delete entry asset

DELETEdelete/episerverapi/commerce/entries/{entryCode}/assets/{assetKey}/{assetType}Delete entry asset

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}/assets/{assetKey}/{assetType}").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}/assets/{assetKey}/{assetType}").Result.Content.ReadAsStringAsync().Result

Response

<ItemAsset xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <CatalogEntryCode>Jackets-Blazers-Wrap</CatalogEntryCode>
  <AssetKey>fd761c1d-5692-48b6-b90a-1ddf4c7c5eb9</AssetKey>
  <AssetType>episerver.core.icontentimage</AssetType>
  <GroupName>large</GroupName>
  <SortOrder>45</SortOrder>
</ItemAsset>

Node assets

Get all node assets

GETget/episerverapi/commerce/nodes/{nodeCode}/assets

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/nodes/{node code}/assets").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/nodes/{node code}/assets").Result.Content.ReadAsStringAsync().Result

Response

<ArrayOfItemAsset xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <ItemAsset>
    <CatalogNodeCode>Fashion</CatalogNodeCode>
    <AssetKey>ed6fc3d7-091f-4e84-b1f6-49b56e7b5146</AssetKey>
    <AssetType>episerver.core.icontentimage</AssetType>
    <GroupName>large</GroupName>
    <SortOrder>45</SortOrder>
  </ItemAsset>
  <ItemAsset>
    <CatalogNodeCode>Fashion</CatalogNodeCode>
    <AssetKey>fe642158-e9cf-43c9-a70d-42cd75903dc6</AssetKey>
    <AssetType>episerver.core.icontentimage</AssetType>
    <GroupName>small</GroupName>
    <SortOrder>0</SortOrder>
  </ItemAsset>
</ArrayOfItemAsset>

Get a specific node asset

GETget/episerverapi/commerce/nodes/{nodeCode}/assets/{assetKey}/{assetType}Get a specific node asset

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/nodes/{node code}/assets/{assetKey}/{assetType}").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/nodes/{node code}/assets/{assetKey}/{assetType}").Result.Content.ReadAsStringAsync().Result

Response

<ItemAsset xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <CatalogNodeCode>Fashion</CatalogNodeCode>
  <AssetKey>ed6fc3d7-091f-4e84-b1f6-49b56e7b5146</AssetKey>
  <AssetType>episerver.core.icontentimage</AssetType>
  <GroupName>large</GroupName>
  <SortOrder>45</SortOrder>
</ItemAsset>

Create node asset

POSTpost/episerverapi/commerce/nodes/{nodeCode}/assetsCreate node asset

JSON response type

var model = new ItemAsset()
  {
    CatalogNodeCode = "Fashion",
    AssetKey = "ed6fc3d7-091f-4e84-b1f6-49b56e7b5146",
    AssetType = "episerver.core.icontentimage",
    SortOrder = 45,
    GroupName = "large"
  };
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/nodes/{node code}/assets",
  new StringContent(json, Encoding.UTF8, "application/json")).Result.Content.ReadAsStringAsync().Result

XML response type

var model = new ItemAsset()
  {
    CatalogNodeCode = "Fashion",
    AssetKey = "ed6fc3d7-091f-4e84-b1f6-49b56e7b5146",
    AssetType = "episerver.core.icontentimage",
    SortOrder = 45,
    GroupName = "large"
  };
var client = new HttpClient()
  {
    BaseAddress = new Uri(ConfigurationManager.AppSettings["integrationUrl"])
  };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);
var serializer = new XmlSerializer(typeof(ItemAsset));
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/nodes/{node code}/assets",
  new StringContent(xml, Encoding.UTF8, "text/xml")).Result.Content.ReadAsStringAsync().Result

Response

<ItemAsset xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <CatalogNodeCode>Fashion</CatalogNodeCode>
  <AssetKey>ed6fc3d7-091f-4e84-b1f6-49b56e7b5146</AssetKey>
  <AssetType>episerver.core.icontentimage</AssetType>
  <GroupName>large</GroupName>
  <SortOrder>45</SortOrder>
</ItemAsset>

Update node asset

PUTput/episerverapi/commerce/nodes/{nodeCode}/assets/{assetKey}/{assetType}Update node asset

JSON response type

var model = new ItemAsset()
  {
    CatalogNodeCode = "Fashion",
    AssetKey = "ed6fc3d7-091f-4e84-b1f6-49b56e7b5146",
    AssetType = "episerver.core.icontentimage",
    SortOrder = 45,
    GroupName = "large"
  };
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/nodes/{node code}/assets/{assetKey}/{assetType}",
  new StringContent(json, Encoding.UTF8, "application/json")).Result.Content.ReadAsStringAsync().Result

XML response type

var model = new ItemAsset()
  {
    CatalogNodeCode = "Fashion",
    AssetKey = "ed6fc3d7-091f-4e84-b1f6-49b56e7b5146",
    AssetType = "episerver.core.icontentimage",
    SortOrder = 45,    
    GroupName = "large"
  };
var client = new HttpClient()
  {
    BaseAddress = new Uri(ConfigurationManager.AppSettings["integrationUrl"])
  };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);
var serializer = new XmlSerializer(typeof(ItemAsset));
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/nodes/{node code}/assets/{assetKey}/{assetType}",
  new StringContent(xml, Encoding.UTF8, "text/xml")).Result.Content.ReadAsStringAsync().Result

Response

200 No Content

Delete node asset

DELETEdelete/episerverapi/commerce/nodes/{nodeCode}/assets/{assetKey}/{assetType}Delete node asset

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/nodes/{node code}/assets/{assetKey}/{assetType}").Result.Content.ReadAsStringAsync().Result

XML response type

ar 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/nodes/{node code}/assets/{assetKey}/{assetType}").Result.Content.ReadAsStringAsync().Result

Response

<ItemAsset xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <CatalogNodeCode>Fashion</CatalogNodeCode>
  <AssetKey>ed6fc3d7-091f-4e84-b1f6-49b56e7b5146</AssetKey>
  <AssetType>episerver.core.icontentimage</AssetType>
  <GroupName>large</GroupName>
  <SortOrder>45</SortOrder>
</ItemAsset>