API Reference: Categories

Categories represent pages in a merchanttribe store. Products can be assigned to one or more categories. Custom HTML pages, and automatic filtering categories are other types of category pages.

Field Type Description
Bvin String (max length 36) The unique ID for the item. System generated GUID value
StoreId Long Will always be 1 for non-hosted stores. Otherwise the store id number
LastUpdatedUtc DateTime The UTC time stamp of the last update
ParentId String The Bvin value of this categories parent category. Use "0" or "" for root categories.
Name String The display name in menus of the category
Description String Optional HTML content for the category/page
DisplaySortOrder CategorySortOrderDTO None = 0,
ManualOrder = 1,
ProductName = 2,
ProductPriceAscending = 3,
ProductPriceDescending = 4,
ManufacturerName = 5
SourceType CategorySourceTypeDTO Manual = 0,
ByRules = 1,(deprecated)
CustomLink = 2,
CustomPage = 3,
DrillDown = 4,
FlexPage = 5 (deprecated)
SortOrder Integer System Generated Sort order (or manually adjusted). Lowest value is displayed first.
MetaKeywords String Text for the Meta Keywords Tag
MetaDescription String Text for the Meta Description Tag
MetaTitle String The Page Title that appears in browser windows & tabs and in the tag.
ImageUrl String The file name of the optional small icon image uploaded for the category
BannerImageUrl String The file name of the optional banner image uploaded for the category
LatestProductCount Integer System generated count of all products assigned to the category
CustomPageUrl String If source type is set to CustomLink then this is the URL of where to link to
CustomPageOpenInNewWindow Boolean If source type is CustomLink a true value adds the target="_blank" attribute to the link.
ShowInTopMenu Boolean Deprecated. This is now automatically selected based on sort order and hidden values
Hidden Boolean If true, the category/page is not displayed in any menu.
TemplateName String The name of the HTML template file to use for CustomPages OR the name of the built-in category layout for Manual Source Type pages.
PreContentColumnId String The Bvin value of a content column to display before products for Manual category source types
PostContentColumnId String The Bvin value of a content column to display after products for Manual category source types
ShowTitle Boolean If true, show the Name field as an H1 tag, otherwise do not display the Name field
Criteria String Deprecated: Serialized criteria for ByRules source type
CustomPageId String Not Used
PreTransformDescription String The description text before any transforms. Used by the MarkDown editor.
Keywords String Alternate search keywords for the internal MerchantTribe search engine
CustomerChangeableSortOrder Boolean If true, customer is allowed to choose sort order, otherwise sort order is locked
CustomPageLayout CustomPageLayoutTypeDTO Deprecated: No longer used
Empty = 0,
WithSideBar = 5
RewriteUrl String The full URL slug for the category. Do not include a leading / character.
Operations List Reserved for future upgrades to the API

Operations

URL
Wrapper Method
Action Description
/api/rest/v1/categories?key={key}
CategoriesFindAll() GET List all categories for the store
/api/rest/v1/categories?key={key}&byproduct={productbvin}
CategoriesFindForProduct(string productBvin) GET Finds all categories assigned to a given product
/api/rest/v1/categories/{bvin}?key={key}
CategoriesFind(string bvin) GET Finds a specific category by Bvin
/api/rest/v1/categories?key={key}&byslug={slug}
CategoriesFindBySlug(string slug) GET Finds a single category by it's URL slug (rewriteUrl field)
/api/rest/v1/categories?key={key}
CategoriesCreate(CategoryDTO category) POST Creates a new category and returns a CategoryDTO object.
/api/rest/v1/categories/{bvin}?key={key}
CategoriesUpdate(CategoryDTO category) POST Updates a Category with Bvin of {bvin} and returns a copy of the updated CategoryDTO
/api/rest/v1/categories/{bvin}?key={key}
CategoriesDelete(string bvin) DELETE Deletes the category with Bvin of {bvin} and returns a boolean value indicating success or failure.
/api/rest/v1/categories?key={key}
CategoriesClearAll() DELETE Removes all categories from the store. NOTE: This method will not function unless the "Allow Clear Operations" button has been clicked under Options->Api in the admin of the store. Allowing clear operations is time limited to 60 minutes as a security precaution.

DTO Source Code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using MerchantTribe.Web;
using System.Runtime.Serialization;

namespace MerchantTribe.CommerceDTO.v1.Catalog
{
    [DataContract]
    public class CategoryDTO
    {
        [DataMember]
        public string Bvin { get; set; }
        [DataMember]
        public DateTime LastUpdatedUtc { get; set; }
        [DataMember]
        public long StoreId { get; set; }
        [DataMember]
        public string ParentId { get; set; }
        [DataMember]
        public string Name { get; set; }
        [DataMember]
        public string Description { get; set; }
        [DataMember]
        public CategorySortOrderDTO DisplaySortOrder { get; set; }
        [DataMember]
        public CategorySourceTypeDTO SourceType { get; set; }
        [DataMember]
        public int SortOrder { get; set; }
        [DataMember]
        public string MetaKeywords { get; set; }
        [DataMember]
        public string MetaDescription { get; set; }
        [DataMember]
        public string MetaTitle { get; set; }
        [DataMember]
        public string ImageUrl { get; set; }
        [DataMember]
        public string BannerImageUrl { get; set; }
        [DataMember]
        public int LatestProductCount { get; set; }
        [DataMember]
        public string CustomPageUrl { get; set; }
        [DataMember]
        public bool CustomPageOpenInNewWindow { get; set; }
        [DataMember]
        public bool ShowInTopMenu { get; set; }
        [DataMember]
        public bool Hidden { get; set; }
        [DataMember]
        public string TemplateName { get; set; }
        [DataMember]
        public string PreContentColumnId { get; set; }
        [DataMember]
        public string PostContentColumnId { get; set; }
        [DataMember]
        public bool ShowTitle { get; set; }
        [DataMember]
        public string Criteria { get; set; }
        [DataMember]
        public string CustomPageId { get; set; }
        [DataMember]
        public string PreTransformDescription { get; set; }
        [DataMember]
        public string Keywords { get; set; }
        [DataMember]
        public bool CustomerChangeableSortOrder { get; set; }
        [DataMember]
        public CustomPageLayoutTypeDTO CustomPageLayout { get; set; }
        [DataMember]
        public string RewriteUrl {get;set;}

        [DataMember]
        public List Operations { get; set; }

        //public List Versions { get; set; }

        public CategoryDTO()
        {
            this.Bvin = string.Empty;
            this.StoreId = 0;
            this.LastUpdatedUtc = DateTime.UtcNow;
            this.ParentId = "0";
            this.Name = string.Empty;
            this.Description = string.Empty;
            this.DisplaySortOrder = CategorySortOrderDTO.ManualOrder;
            this.SourceType = CategorySourceTypeDTO.Manual;
            this.SortOrder = 0;
            this.MetaKeywords = string.Empty;
            this.MetaDescription = string.Empty;
            this.MetaTitle = string.Empty;
            this.ImageUrl = string.Empty;
            this.BannerImageUrl = string.Empty;
            this.LatestProductCount = 0;
            this.CustomPageUrl = string.Empty;
            this.ShowInTopMenu = false;
            this.Hidden = false;
            this.TemplateName = "BV Grid";
            this.PreContentColumnId = string.Empty;
            this.PostContentColumnId = string.Empty;
            this.ShowTitle = true;
            this.Criteria = string.Empty;
            this.CustomPageId = string.Empty;
            this.PreTransformDescription = string.Empty;
            this.Keywords = string.Empty;
            this.CustomerChangeableSortOrder = true;
            this.CustomPageLayout = CustomPageLayoutTypeDTO.Empty;
            this.RewriteUrl = string.Empty;

            //this.Versions = new List();

            this.Operations = new List();            
        }
              
    } 
}