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

Catalog entry prices

Recommended reading 

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

In this topic

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

get/episerverapi/commerce/entries/{entryCode}/prices

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

XML response type

Get a specific entry price

get/episerverapi/commerce/entries/{entryCode}/prices/{priceValueId}

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

XML response type

Create entry price

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

JSON response type

C# code sample

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

Update entry price

Updates the catalog entry prices.

put/episerverapi/commerce/entries/{entryCode}/prices
put/episerverapi/commerce/entries/{entryCode}/prices/{priceValueId}

JSON response type

C# code sample

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

Delete entry price

delete/episerverapi/commerce/entries/{entryCode}/prices/{priceValueId}

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

XML response type

Special strings

These properties require special values to function properly.

PriceTypeId

  • PriceGroup
  • AllCustomers
  • UserName

Related topics

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

Last updated: Aug 14, 2017

Recommended reading