Loading...
Area: Episerver Service API
Applies to versions: 1 and higher

Catalog entries

Recommendations [hide]

This topic describes how to work with RESTful operations for catalogs entries in the Episerver Service API. The Service API supports published versions of catalogs (from version 1.0 and higher), as well as common draft versions of catalogs (from version 5.1.0). 

In this topic

Special strings

Theses properties require special values to function properly.

InventoryStatus

  • Enabled
  • Disabled
  • Ignored

EntryType

  • Product
  • Variation
  • Package
  • Bundle
  • DynamicPackage

Example models

[Serializable]
public class NameValue
  {
    public string Name { get; set; }
    public string Value { get; set; }
  }
[Serializable]
public class ResourceLink
  {
    public string Title { get; set; }
    public string Type { get; set; }
    public string Href { get; set; }
    public List<NameValue> Properties { get; set; }
  }  

[Serializable]
public class SeoInfo
  {
    public string Title { get; set; }
    public string Uri { get; set; }
    public string UriSegment { get; set; }
    public string Description { get; set; }
    public string Keywords { get; set; }
    public string LanguageCode { get; set; }
  }
    
[Serializable]
public class MetaFieldData
  {
    public string Language { get; set; }
    public string Value { get; set; }
  }

[Serializable]
public class MetaFieldProperty
  {
    public string Name { get; set; }
    public string Type { get; set; }
    public List<MetaFieldData> Data { get; set; }
  }

[Serializable]
public class VariationProperties
  {
    public decimal MinQuantity { get; set; }
    public decimal MaxQuantity { get; set; }
    public double Weight { get; set; }
    public String TaxCategory { get; set; }
  }

[Serializable]
public class DimensionProperties
  {
    public double Length { get; set; }
    public double Heigth { get; set; }
    public double Width {get; set; }
  }

[Serializable]
public class Entry
  {
    public Entry()
      {
        SeoInformation = new List<SeoInfo>();
        Assets = new List<ResourceLink>();
        Associations = new List<ResourceLink>();
        MetaFields = new List<MetaFieldProperty>();
        WarehouseInventories = new List<ResourceLink>();
        Prices = new List<ResourceLink>();
        ChildCatalogEntries = new List<ResourceLink>();
        Nodes = new List<ResourceLink>();
        ParentCatalogEntry = new ResourceLink();
        Variation = null;
      }
    public string Code { get; set; }
    public Guid? ApplicationId { get; set; }
    public string Name { get; set; }
    public ResourceLink ParentCatalogEntry { get; set; }
    public DateTime StartDate { get; set; }
    public DateTime EndDate { get; set; }
    public bool IsActive { get; set; }
    public string MetaClass { get; set; }
    public string Catalog { get; set; }
    public List<MetaFieldProperty> MetaFields { get; set; }
    public List<SeoInfo> SeoInformation { get; set; }
    public List<ResourceLink> Prices { get; set; }
    public string EntryType { get; set; }
    public List<ResourceLink> ChildCatalogEntries { get; set; }
    public string InventoryStatus { get; set; }
    public List<ResourceLink> WarehouseInventories { get; set; }
    public List<ResourceLink> Associations { get; set; }
    public List<ResourceLink> Assets { get; set; }
    public List<ResourceLink> Nodes { get; set; }
    public VariationProperties Variation { get; set; }
    public DimensionProperties Dimension {get; set; }
  }

[Serializable]
public class Entries
  {
    public Entries()
      {
        EntryResults = new List<Entry>();
        TotalCount = 0;
        TotalPages = 0;
      }
    public List<Entry> EntryResults { get; set; }
    public int TotalCount { get; set; }
    public int TotalPages { get; set; }
  }

Get All Entries

/episerverapi/commerce/entries/{startPage}/{pageSize}

By default this method gets all languages for the entries. If you want only one specific language, use the Accept-Language header. 

Client Code Media Type JSON

Client Code Media Type XML

Get Entry

/episerverapi/commerce/entries/{entry code}

By default this method gets all languages for the entry. If you want only one specific language use the Accept-Language header.

Client Code Media Type JSON

Client Code Media Type XML

Post Entry

/episerverapi/commerce/entries

Client Code Media Type JSON

Client Code Media Type XML

Put Entry

/episerverapi/commerce/entries/{entry code}

Client Code Media Type JSON

Client Code Media Type XML

Delete Entry

/episerverapi/commerce/entries/{entry code}

Client Code Media Type JSON

Client Code Media Type XML

Common draft entries [New in Service API 5.1.0]

Use the endpoints listed below to get common draft versions, create new common drafts, and update or delete existing drafts.

Get common draft entry

Post common draft entry

Note: The Episerver Service API does not support creating common drafts for non-existing content. You can create a first draft version by using an endpoint for published content (without “commondraft”) and setting IsActive to “false”.

Put common draft entry

Notes: If common draft content is in “Published” state, a new common draft version is created (same behavior as Post common draft). If common draft content is in a DelayedPublish/AwaitingApproval/CheckedIn state, then it skips updating content and returns a Conflict status code (409).

Delete common draft entry

Special characters included in entry code [New version 5.4.2]

As of version 5.4.2, the Service API supports special characters (such as "/", "%" or "+") in the entry code for all actions (get all, get a specific, post, put or delete) for these objects:

  • Catalog entry
  • Catalog entry association
  • Catalog entry relation
  • Catalog item asset
  • Catalog entry price

The special characters must be double-encoded then sent to the Service API. For example, the slash character (/) is double-encoded as %252F.

Note: Because double escaping in URLs involves security risks, it is preferable to avoid this approach.

To enable double-encoding support, edit the site 's web.config file as shown below:

<system.webServer>
    <security>
        <requestFiltering allowDoubleEscaping="true"/>
    </security>
</system.webServer>

<httpRuntime requestPathInvalidCharacters="&lt;,&gt;,*,&amp;,:,\,?" />

Note: The characters listed after requestPathInvalidCharacters are only an example of special characters for which you can enable double-encoding support. You can modify the list as needed.

Related topics

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

Last updated: Oct 20, 2016

Recommendations [hide]