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

Catalog

Recommendations [hide]

This topic describes how to work with RESTful operations for catalogs 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

Example models

/// <summary>
/// The catalog base model.
/// </summary>
[Serializable]
public abstract class CatalogBase
  {
    /// <summary>
    /// Gets or sets the end date.
    /// </summary>
    /// <value>
    /// The end date.
    /// </value>
    public DateTime EndDate { get; set; }

    /// <summary>
    /// Gets or sets the start date.
    /// </summary>
    /// <value>
    /// The start date.
    /// </value>
    public DateTime StartDate { get; set; }

    /// <summary>
    /// Gets or sets a value indicating whether this instance is primary.
    /// </summary>
    /// <value>
    /// <c>true</c> if this instance is primary; otherwise, <c>false</c>.
    /// </value>
    public bool IsPrimary { get; set; }

    /// <summary>
    /// Gets or sets the owner.
    /// </summary>
    /// <value>
    /// The owner.
    /// </value>
    public string Owner { get; set; }

    /// <summary>
    /// Gets or sets the sort order.
    /// </summary>
    /// <value>
    /// The sort order.
    /// </value>
    public int SortOrder { get; set; }

    /// <summary>
    /// Gets or sets the name.
    /// </summary>
    /// <value>
    /// The name.
    /// </value>
    public string Name { get; set; }

    /// <summary>
    /// Gets or sets the default currency.
    /// </summary>
    /// <value>
    /// The default currency.
    /// </value>
    public string DefaultCurrency { get; set; }

    /// <summary>
    /// Gets or sets the default language.
    /// </summary>
    /// <value>
    /// The default language.
    /// </value>
    public string DefaultLanguage { get; set; }

    /// <summary>
    /// Gets or sets the weight base.
    /// </summary>
    /// <value>
    /// The weight base.
    /// </value>
    public string WeightBase { get; set; }

    /// <summary>
    /// Gets or sets the length base.
    /// </summary>
    /// <value>
    /// The length base.
    /// </value>
    public string LengthBase { get; set; }
  }

/// <summary>
/// The catalog model.
/// </summary>
[Serializable]
public class Catalog: CatalogBase
  {
    /// <summary>
    /// Gets or sets a value indicating whether this instance is active.
    /// </summary>
    /// <value>
    ///   <c>true</c> if this instance is active; otherwise, <c>false</c>.
    /// </value>
    public bool IsActive { get; set; }

    /// <summary>
    /// Gets or sets the languages.
    /// </summary>
    /// <value>
    /// The languages.
    /// </value>
    public List<CatalogLanguage> Languages { get; set; }

    /// <summary>
    /// Gets or sets the nodes.
    /// </summary>
    /// <value>The nodes.</value>
    public List<ResourceLink> Nodes { get; set; }

    /// <summary>
    /// Gets or sets the entries.
    /// </summary>
    /// <value>
    /// The entries.
    /// </value>
    public List<ResourceLink> Entries { get; set; }
  }

/// <summary>
/// The draft catalog model.
/// </summary>
[Serializable]
public class DraftCatalog : CatalogBase
  {
    /// <summary>
    /// Gets or sets the route segment.
    /// </summary>
    /// <value>The route segment.</value>
    public string RouteSegment { get; set; }
  }

Published catalog version

Get all catalogs

/episerverapi/commerce/catalogs

Get a specific catalog

/episerverapi/commerce/catalogs/{name}

Create catalog

/episerverapi/commerce/catalogs

Update catalog

/episerverapi/commerce/catalogs/{name}

Delete catalog

/episerverapi/commerce/catalogs/{name}

Common draft catalog version [New in 5.1.0]

From version 5.1.0, the Service API supports working with a common draft catalog. By adding new endpoints (listed below), you can get common draft catalog versions, create new common drafts, and update or delete existing common draft catalogs. 

Get common draft catalog

/episerverapi/commerce/catalogs/{name}/commondraft/{lang}

Post common draft catalog

/episerverapi/commerce/catalogs/commondraft/{lang}

Note: Episerver 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 catalog

/episerverapi/commerce/catalogs/{name}/commondraft/{lang}

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

Delete common draft catalog

/episerverapi/commerce/catalogs/{name}/commondraft/{lang}

Related topics

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

Last updated: Jul 30, 2018

Recommendations [hide]