API Reference: Products
Products represent items available for sale in a merchanttribe store.
| 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 |
| CreationDateUtc | DateTime | The UTC time stamp of when the item was created |
| Sku | String | A unique series of letters and numbers to identify the item. User created. |
| ProductName | String | The display name of the item |
| ProductTypeId | String | The Bvin value of the product type for this product. Can be left blank |
| CustomProperties | List | A list (array) of CustomPropertyDTO objects:public class CustomPropertyDTO
{
public string DeveloperId {get;set;}
public string Key {get;set;}
public string Value {get;set;}
public CustomPropertyDTO()
{
DeveloperId = string.Empty;
Key = string.Empty;
Value = string.Empty;
}
}
|
| ListPrice | Decimal | The suggested retail price for the item |
| SitePrice | Decimal | The price the item will actually sell for on the store |
| SiteCost | Decimal | Optional: May be used in future reports and offers. Merchant's cost to sell the item |
| SitePriceOverrideText | String | When not empty this text is displayed instead of the product price. For example: Call for Pricing |
| 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. |
| TaxExempt | Bool | If true no tax is charged for the item |
| TaxSchedule | Long | The ID value of the tax schedule for this product |
| ShippingDetails | Shipping.ShippabelItemDTO | Shipping Details Class:
public class ShippableItemDTO
{
public bool IsNonShipping { get; set; }
public decimal ExtraShipFee { get; set; }
public decimal Weight { get; set; }
public decimal Length { get; set; }
public decimal Width { get; set; }
public decimal Height { get; set; }
public long ShippingScheduleId { get; set; }
public ShippingModeDTO ShippingSource { get; set; }
public string ShippingSourceId { get; set; }
public bool ShipSeparately { get; set; }
public ShippableItemDTO()
{
IsNonShipping = false;
ExtraShipFee = 0m;
Weight = 0m;
Length = 0m;
Width = 0m;
Height = 0m;
ShippingScheduleId = 0;
ShippingSource = ShippingModeDTO.ShipFromSite;
ShippingSourceId = string.Empty;
ShipSeparately = false;
}
}
|
| ShippingMode | Shipping.ShippingModeDTO | None = 0, ShipFromSite = 1, ShipFromVendor = 2, ShipFromManufacturer = 3 |
| Status | ProductStatusDTO | Active = 1, Disabled = 0, NotSet = -1 |
| ImageFileSmall | String | The file name of the main image uploaded for the item |
| ImageFileSmallAlternateText | String | Alt text to display in image tag |
| ImageFileMedium | String | Deprecated: Not Used |
| ImageFileMediumAlternateText | String | Deprecated: Not Used |
| MinimumQty | Integer | The minimum amount of the item that must be ordered at one time. Defaults to 1. |
| ShortDescription | String | Reserved for Future Use |
| LongDescription | String | The HTML description of the item |
| ManufacturerId | String | The Bvin value of the manufacturer for the item. Can be blank. |
| VendorId | String | The Bvin value of the vendor for the item. Can be blank. |
| GiftWrapAllowed | Boolean | Should the item be allowed to be gift wrapped? |
| GiftWrapPrice | Decimal | The price of gift wrapping per item |
| Keywords | String | Alternate search keywords for the internal MerchantTribe search engine |
| PreContentColumnId | String | The Bvin value of a content column to display before product |
| PostContentColumnId | String | The Bvin value of a content column to display after product |
| UrlSlug | String | The full URL slug for the product. Do not include a leading / character. |
| PreTransformLongDescription | String | The HTML description of the item before MarkDown Transforms |
| InventoryMode | ProductInventoryModeDTO | NotSet = -1, Unknown = 0, AlwayInStock = 100, WhenOutOfStockHide = 101, WhenOutOfStockShow = 102, WhenOutOfStockAllowBackorders = 103 |
| IsAvailableForSale | Boolean | Auto-set by the system. Do not manually adjust. |
| Featured | Boolean | If true the item appears on the homepage of the store. This is likely to go away in the future. |
| AllowReviews | Boolean | Are customers allowed to create reviews for this item? |
| Tabs | List | A list (array) of tabs:
public class ProductDescriptionTabDTO
{
public string Bvin {get;set;}
public string TabTitle {get;set;}
public string HtmlData {get;set;}
public int SortOrder {get;set;}
public ProductDescriptionTabDTO()
{
Bvin = string.Empty;
TabTitle = string.Empty;
HtmlData = string.Empty;
SortOrder = 0;
}
}
|
Operations
| URL Wrapper Method | Action | Description |
|---|---|---|
| /api/rest/v1/products?key={key} | ||
| ProductsFindAll() | GET | List all products for the store |
| /api/rest/v1/products?key={key}&bycategory={categorybvin}&page={pagenumber}&pagesize={pagesize} | ||
| ProductsFindForCategory(string categoryBvin, int pageNumber, int pageSize) | GET | Finds a page of products assigned to a given category |
| /api/rest/v1/products?key={key}&countyonly=1 | ||
| ProductsCountOfAll() | GET | List count of all products for the store |
| /api/rest/v1/products/{bvin}?key={key} | ||
| ProductsFind(string bvin) | GET | Finds a specific product by Bvin |
| /api/rest/v1/products/ANY?key={key}&bysku={sku} | ||
| ProductsFindBySku(string sku) | GET | Finds a single product by it's SKU |
| /api/rest/v1/products/ANY?key={key}&byslug={slug} | ||
| ProductsFindBySlug(string slug) | GET | Finds a single product by it's URL slug |
| /api/rest/v1/products?key={key} | ||
| ProductsCreate(ProductDTO product) | POST | Creates a new Product and returns a ProductDTO object. |
| /api/rest/v1/products/{bvin}?key={key} | ||
| ProductsUpdate(ProductDTO product) | POST | Updates a Product with Bvin of {bvin} and returns a copy of the updated ProductDTO |
| /api/rest/v1/products/{bvin}?key={key} | ||
| ProductsDelete(string bvin) | DELETE | Deletes the product with Bvin of {bvin} and returns a boolean value indicating success or failure. |
| /api/rest/v1/products?key={key} | ||
| ProductsClearAll() | DELETE | Removes all products 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.Runtime.Serialization;
using System.Xml.Serialization;
namespace MerchantTribe.CommerceDTO.v1.Catalog
{
[Serializable()]
[XmlInclude(typeof(MerchantTribe.CommerceDTO.v1.CustomPropertyDTO))]
[XmlInclude(typeof(MerchantTribe.CommerceDTO.v1.Shipping.ShippableItemDTO))]
[XmlInclude(typeof(MerchantTribe.CommerceDTO.v1.Shipping.ShippingModeDTO))]
[XmlInclude(typeof(MerchantTribe.CommerceDTO.v1.Catalog.ProductStatusDTO))]
[XmlInclude(typeof(MerchantTribe.CommerceDTO.v1.Catalog.ProductInventoryModeDTO))]
[XmlInclude(typeof(MerchantTribe.CommerceDTO.v1.Catalog.ProductDescriptionTabDTO))]
public class ProductDTO
{
[DataMember]
public string Bvin { get; set; }
[DataMember]
public string Sku { get; set; }
[DataMember]
public string ProductName { get; set; }
[DataMember]
public string ProductTypeId { get; set; }
[DataMember]
public List CustomProperties { get; set; }
[DataMember]
public decimal ListPrice { get; set; }
[DataMember]
public decimal SitePrice { get; set; }
[DataMember]
public string SitePriceOverrideText { get; set; }
[DataMember]
public decimal SiteCost { get; set; }
[DataMember]
public string MetaKeywords { get; set; }
[DataMember]
public string MetaDescription { get; set; }
[DataMember]
public string MetaTitle { get; set; }
[DataMember]
public bool TaxExempt { get; set; }
[DataMember]
public long TaxSchedule { get; set; }
[DataMember]
public Shipping.ShippableItemDTO ShippingDetails { get; set; }
[DataMember]
public Shipping.ShippingModeDTO ShippingMode {get;set;}
[DataMember]
public ProductStatusDTO Status { get; set; }
[DataMember]
public string ImageFileSmall { get; set; }
[DataMember]
public string ImageFileSmallAlternateText { get; set; }
[DataMember]
public string ImageFileMedium { get; set; }
[DataMember]
public string ImageFileMediumAlternateText { get; set; }
[DataMember]
public System.DateTime CreationDateUtc { get; set; }
[DataMember]
public int MinimumQty { get; set; }
[DataMember]
public string ShortDescription { get; set; }
[DataMember]
public string LongDescription { get; set; }
[DataMember]
public string ManufacturerId { get; set; }
[DataMember]
public string VendorId { get; set; }
[DataMember]
public bool GiftWrapAllowed { get; set; }
[DataMember]
public decimal GiftWrapPrice { get; set; }
[DataMember]
public string Keywords { get; set; }
[DataMember]
public string PreContentColumnId { get; set; }
[DataMember]
public string PostContentColumnId { get; set; }
[DataMember]
public string UrlSlug { get; set; }
[DataMember]
public string PreTransformLongDescription { get; set; }
[DataMember]
public ProductInventoryModeDTO InventoryMode { get; set; }
[DataMember]
public bool IsAvailableForSale { get; set; }
//[DataMember]
//public List Options { get; set; }
//[DataMember]
//public List Variants { get; set; }
[DataMember]
public bool Featured { get; set; }
[DataMember]
public bool AllowReviews { get; set; }
[DataMember]
public List Tabs { get; set; }
[DataMember]
public long StoreId { get; set; }
public ProductDTO()
{
this.Bvin = string.Empty;
this.Sku = string.Empty;
this.ProductName = string.Empty;
this.ProductTypeId = string.Empty;
this.CustomProperties = new List();
this.ListPrice = 0m;
this.SitePrice = 0m;
this.SitePriceOverrideText = string.Empty;
this.SiteCost = 0m;
this.MetaKeywords = string.Empty;
this.MetaDescription = string.Empty;
this.MetaTitle = string.Empty;
this.TaxExempt = false;
this.TaxSchedule = -1;
this.Status = ProductStatusDTO.Active;
this.ImageFileSmall = string.Empty;
this.ImageFileMedium = string.Empty;
this.ImageFileSmallAlternateText = string.Empty;
this.ImageFileMediumAlternateText = string.Empty;
this.CreationDateUtc = DateTime.UtcNow;
this.MinimumQty = 1;
this.ShortDescription = string.Empty;
this.LongDescription = string.Empty;
this.ManufacturerId = string.Empty;
this.VendorId = string.Empty;
this.GiftWrapAllowed = false;
this.Keywords = string.Empty;
this.PreContentColumnId = string.Empty;
this.PostContentColumnId = string.Empty;
this.UrlSlug = string.Empty;
this.PreTransformLongDescription = string.Empty;
this.GiftWrapPrice = 0m;
//this.Options = new List();
//this.Variants = new List();
this.ShippingDetails = new Shipping.ShippableItemDTO();
this.Featured = false;
this.AllowReviews = false;
this.Tabs = new List();
this.StoreId = 0;
this.IsAvailableForSale = true;
}
}
}