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

Catalog entry node relations

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

Example models

[Serializable]
public class NodeEntryRelation
  {
    public int SortOrder { get; set; }
    public string NodeCode { get; set; }
    public string EntryCode { get; set; }
    public bool? IsPrimary { get; set; } //Optinal, if missing will be treated as False
  }

Get all entry node relations

GETget/episerverapi/commerce/entries/{entryCode}/nodeentryrelationsGet all entry node relations

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

Response

<ArrayOfNodeEntryRelation xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <NodeEntryRelation>
    <SortOrder>0</SortOrder>
    <NodeCode>Tops-Tunics</NodeCode>
    <EntryCode>Tops-Tunics-LongSleeve</EntryCode>
    <IsPrimary>True</IsPrimary>
</NodeEntryRelation> </ArrayOfNodeEntryRelation>

Get a specific entry node relation

GETget/episerverapi/commerce/entries/{entryCode}/nodeentryrelations/{nodeCode}Get a specific entry node relation

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

Response

<NodeEntryRelation xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <SortOrder>0</SortOrder>
  <NodeCode>Tops-Tunics</NodeCode>
  <EntryCode>Tops-Tunics-LongSleeve</EntryCode>
</NodeEntryRelation>

Create entry node relation

📘

Note

Setting a NodeEntryRelation with IsPrimary = true makes the current primary relation for that entry non-primary.

POSTpost/episerverapi/commerce/entries/{entryCode}/nodeentryrelationsCreate entry node relation

JSON response type

var model = new NodeEntryRelation()
  {
    EntryCode = "Tops-Tunics-LongSleeve",
    NodeCode = "Tops-Sweaters",
    SortOrder = 0,
    IsPrimary = true
  };
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}/nodeentryrelations", 
  new StringContent(json, Encoding.UTF8, "application/json")).Result.Content.ReadAsStringAsync().Result

XML response type

var model = new NodeEntryRelation()
  {
    EntryCode = "Tops-Tunics-LongSleeve",
    NodeCode = "Tops-Sweaters",
    SortOrder = 0
  };
var client = new HttpClient()
  {
    BaseAddress = new Uri(ConfigurationManager.AppSettings["integrationUrl"])
  };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);
var serializer = new XmlSerializer(typeof(NodeEntryRelation));
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}/nodeentryrelations", 
  new StringContent(xml, Encoding.UTF8, "text/xml")).Result.Content.ReadAsStringAsync().Result

Response

<NodeEntryRelation xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <SortOrder>0</SortOrder>
  <NodeCode>Tops-Sweaters</NodeCode>
  <EntryCode>Tops-Tunics-LongSleeve</EntryCode>
  <IsPrimary>True</IsPrimary>
</NodeEntryRelation>

Update entry node relation

📘

Note

Setting a NodeEntryRelation with IsPrimary = true makes the current primary relation for that entry non-primary.

PUTput/episerverapi/commerce/entries/{entryCode}/nodeentryrelations/{nodeCode}Update entry node relation

JSON response type

var model = new NodeEntryRelation()
  {
    EntryCode = "Tops-Tunics-LongSleeve",
    NodeCode = "Tops-Sweaters",
    SortOrder = 0,
    IsPrimary = true
  };
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}/nodeentryrelations/{node code}",
  new StringContent(json, Encoding.UTF8, "application/json")).Result.Content.ReadAsStringAsync().Result

XML response type

var model = new NodeEntryRelation()
  {
    EntryCode = "Tops-Tunics-LongSleeve",
    NodeCode = "Tops-Sweaters",
    SortOrder = 0,
    IsPrimary = true
  };
var client = new HttpClient()
  {
    BaseAddress = new Uri(ConfigurationManager.AppSettings["integrationUrl"])
  };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);
var serializer = new XmlSerializer(typeof(NodeEntryRelation));
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}/nodeentryrelations/{node code}",
  new StringContent(xml, Encoding.UTF8, "text/xml")).Result.Content.ReadAsStringAsync().Result

Response

200 No Content

Delete entry node relation

DELETEdelete/episerverapi/commerce/entries/{entryCode}/nodeentryrelations/{nodeCode}Delete entry node relation

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

Response

<NodeEntryRelation xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <SortOrder>0</SortOrder>
  <NodeCode>Tops-Sweaters</NodeCode>
  <EntryCode>Tops-Tunics-LongSleeve</EntryCode>
  <IsPrimary>True</IsPrimary>
</NodeEntryRelation>