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

Catalog entry prices

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

Example models

[Serializable]
public class Price
  {
    public Price()
      {
        PriceValueId = null;
        PriceCode = "";
      }
    public long? PriceValueId { get; set; }
    public string CatalogEntryCode { get; set; }
    public string MarketId { get; set; }
    public string PriceTypeId { get; set; }
    public string PriceCode { get; set; }
    public DateTime ValidFrom { get; set; }
    public DateTime? ValidUntil { get; set; }
    public decimal MinQuantity { get; set; }
    public decimal UnitPrice { get; set; }
    public string CurrencyCode { get; set; }
  }

Get all entry prices

GETget/episerverapi/commerce/entries/{entryCode}/pricesGet all entry prices

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

Response

<ArrayOfPrice xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Price>
    <PriceValueId>246</PriceValueId>
    <CatalogEntryCode>Jackets-Peacoats-Hooded-Tan-Small</CatalogEntryCode>
    <MarketId>USACAN</MarketId>
    <PriceTypeId>AllCustomers</PriceTypeId>
    <PriceCode />
    <ValidFrom>2010-09-01T13:00:00Z</ValidFrom>
    <ValidUntil xsi:nil="true" />
    <MinQuantity>0.000000000</MinQuantity>
    <UnitPrice>1000.0000</UnitPrice>
    <CurrencyCode>USD</CurrencyCode>
  </Price>
  <Price>
    <PriceValueId>247</PriceValueId>
    <CatalogEntryCode>Jackets-Peacoats-Hooded-Tan-Small</CatalogEntryCode>
    <MarketId>SCANDINA</MarketId>
    <PriceTypeId>AllCustomers</PriceTypeId>
    <PriceCode />
    <ValidFrom>2010-09-01T13:00:00Z</ValidFrom>
    <ValidUntil xsi:nil="true" />
    <MinQuantity>0.000000000</MinQuantity>
    <UnitPrice>775.2000</UnitPrice>
    <CurrencyCode>EUR</CurrencyCode>
  </Price>
  <Price>
    <PriceValueId>248</PriceValueId>
    <CatalogEntryCode>Jackets-Peacoats-Hooded-Tan-Small</CatalogEntryCode>
    <MarketId>LATAMER</MarketId>
    <PriceTypeId>AllCustomers</PriceTypeId>
    <PriceCode />
    <ValidFrom>2010-09-01T13:00:00Z</ValidFrom>
    <ValidUntil xsi:nil="true" />
    <MinQuantity>0.000000000</MinQuantity>
    <UnitPrice>1000.0000</UnitPrice>
    <CurrencyCode>USD</CurrencyCode>
  </Price>
</ArrayOfPrice>

Get a specific entry price

GETget/episerverapi/commerce/entries/{entryCode}/prices/{priceValueId}Get a specific entry price

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

Response

<Price xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <PriceValueId>250</PriceValueId>
  <CatalogEntryCode>Jackets-Peacoats-Hooded-Tan-Small</CatalogEntryCode>
  <MarketId>DEFAULT</MarketId>
  <PriceTypeId>AllCustomers</PriceTypeId>
  <PriceCode />
  <ValidFrom>2014-08-26T13:27:01.167Z</ValidFrom>
  <ValidUntil>2014-12-04T13:27:01.167Z</ValidUntil>
  <MinQuantity>0.000000000</MinQuantity>
  <UnitPrice>30.0000</UnitPrice>
  <CurrencyCode>USD</CurrencyCode>
</Price>

Create entry price

POSTpost/episerverapi/commerce/entries/{entryCode}/pricesCreate entry price

JSON response type

var model = new Price()
  {
    CatalogEntryCode = "Jackets-Peacoats-Hooded-Tan-Small",
    CurrencyCode = "USD",
    MarketId = "DEFAULT",
    MinQuantity = 0,
    PriceCode = "mark",
    PriceTypeId = "PriceGroup",
    UnitPrice = 30,
    ValidFrom = DateTime.UtcNow,
    ValidUntil = DateTime.UtcNow.AddDays(100)
  };
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}/prices",
  new StringContent(json, Encoding.UTF8, "application/json")).Result.Content.ReadAsStringAsync().Result

XML response type

var model = new Price()
  {
    CatalogEntryCode = "Jackets-Peacoats-Hooded-Tan-Small",
    CurrencyCode = "USD",
    MarketId = "DEFAULT",
    MinQuantity = 0,
    PriceCode = "mark",
    PriceTypeId = "PriceGroup",
    UnitPrice = 30,
    ValidFrom = DateTime.UtcNow,
    ValidUntil = DateTime.UtcNow.AddDays(100)
  };
var client = new HttpClient()
  {
    BaseAddress = new Uri(ConfigurationManager.AppSettings["integrationUrl"])
  };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);
var serializer = new XmlSerializer(typeof(Price));
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}/prices",
  new StringContent(xml, Encoding.UTF8, "text/xml")).Result.Content.ReadAsStringAsync().Result

Response

<Price xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <PriceValueId>154401</PriceValueId>
  <CatalogEntryCode>Jackets-Peacoats-Hooded-Tan-Small</CatalogEntryCode>
  <MarketId>DEFAULT</MarketId>
  <PriceTypeId>PriceGroup</PriceTypeId>
  <PriceCode>mark</PriceCode>
  <ValidFrom>2014-08-26T13:52:19.4457295Z</ValidFrom>
  <ValidUntil>2014-12-04T13:52:19.4457295Z</ValidUntil>
  <MinQuantity>0</MinQuantity>
  <UnitPrice>30</UnitPrice>
  <CurrencyCode>USD</CurrencyCode>
</Price>

Update entry price

PUTput/episerverapi/commerce/entries/{entryCode}/prices/{priceValueId}Update entry price
PUTput/episerverapi/commerce/entries/{entryCode}/pricesUpdates the catalog entry prices.

JSON response type

var model = new Price()
  {
    CatalogEntryCode = "Jackets-Peacoats-Hooded-Tan-Small",
    CurrencyCode = "USD",
    MarketId = "DEFAULT",
    MinQuantity = 0,
    PriceCode = "",
    PriceTypeId = "AllCustomers",
    PriceValueId = 250,
    UnitPrice = 30,
    ValidFrom = DateTime.UtcNow,
    ValidUntil = DateTime.UtcNow.AddDays(100)
  };
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}/prices/{priceValueId}",
  new StringContent(json, Encoding.UTF8, "application/json")).Result.Content.ReadAsStringAsync().Result

XML response type

var model = new Price()
  {
    CatalogEntryCode = "Jackets-Peacoats-Hooded-Tan-Small",
    CurrencyCode = "USD",
    MarketId = "DEFAULT",
    MinQuantity = 0,
    PriceCode = "",
    PriceTypeId = "AllCustomers",
    PriceValueId = 250,
    UnitPrice = 30,
    ValidFrom = DateTime.UtcNow,
    ValidUntil = DateTime.UtcNow.AddDays(100)
  };
var client = new HttpClient()
  {
    BaseAddress = new Uri(ConfigurationManager.AppSettings["integrationUrl"])
  };
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token.AccessToken);
var serializer = new XmlSerializer(typeof(Price));
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}/prices/{priceValueId}",
  new StringContent(xml, Encoding.UTF8, "text/xml")).Result.Content.ReadAsStringAsync().Result

Response

204 No Content

Delete entry price

DELETEdelete/episerverapi/commerce/entries/{entryCode}/prices/{priceValueId}Delete entry price

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

Response

<Price xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <PriceValueId>154401</PriceValueId>
  <CatalogEntryCode>Jackets-Peacoats-Hooded-Tan-Small</CatalogEntryCode>
  <MarketId>DEFAULT</MarketId>
  <PriceTypeId>PriceGroup</PriceTypeId>
  <PriceCode>mark</PriceCode>
  <ValidFrom>2014-08-26T13:52:19.4457295Z</ValidFrom>
  <ValidUntil>2014-12-04T13:52:19.4457295Z</ValidUntil>
  <MinQuantity>0</MinQuantity>
  <UnitPrice>30</UnitPrice>
  <CurrencyCode>USD</CurrencyCode>
</Price>

Special strings

These properties require special values to function properly.

PriceTypeId

  • PriceGroup
  • AllCustomers
  • UserName