Products

(ms.products)

A product is an item put up for sale in a store. Products can be physical, digital (such as a movie, music or ebook file) and services (such as equipment rental, work for hire, customization of another product or an extended warranty).



Fields

ValueDescription
name   
Type: string
Required
Name of product.
Floral shirt
alias   
Type: string
Aliases are the unique product URL on storefront.
floral-shirt
description   
Type: string
A brief description of the product.
Regular fit, cotton floral shirt
images   
Type: array
Images for the product.
{
  "images": [
    {
    "tags": "floral",
    "image":"ms.products/558efa4358ae3b30020bcbf7/images/558efa4358ae3b30020bcbf8/558ef88fc17ed8460cfcb588/558ef88fc17ed8460cfcb588.jpg", 
    "caption": "Floral shirt",
    }
  ]
}
image
Type: image
Required
Single image related to the product.
caption
Type: string
This field holds text which acts as title of image on storefront.
tags
Type: string
Image tags are used to relate product images to their respective variants values.
media   
Type: array
Any media associated with the product.
{
"media": [
    {
      "url": "https://www.youtube.com/watch?v=u2XCdkL4bWI",
      "caption": "Demo of using product",
      "tag": "product media"
    }
  ]
}  
url
Type: string
Required
Embedded URL of the video of the product.
caption
Type: string
Alternative text which will be visible on the storefront.
tags
Type: string
Media tags are used to relate product videos to their respective variants.
price   
Type: number
Required
The selling price of the product at which the product is sold.
2000
compare_price   
Type: number
Compare price is the listing price of the product.
1542
mrp_discount   
Type: number
collections   
Type: array
Collections are used to group products across different categories together.
{
  "collections":["collection_1", "collection_2", "collection_3"]
}
uniquesku   
Type: string
brand   
Type: string
Brand is the identity of the product’s manufacturer.
Lee Cooper
sku   
Type: string
SKU (Stock-Keeping Unit) is the unique identifier or code that is used to identify the product or any of its variants.
shirt-floral
barcode   
Type: string
Barcode of the product.
isbn   
Type: string
ISBN code of the product.
hsn   
Type: string
HSN code of the product.
sac   
Type: string
SAC code of the product.
upc   
Type: string
UPC code of the product.
product_tax_code   
Type: string
uom   
Type: string
categories   
Type: array
Categories help you to categorize the products based on different qualities of the product.
{
"categories":["category_1","category_2", "category_3"]
}
avg_rating   
Type: string
Ratings of the product given by users.
num_reviews   
Type: number
This field holds count of product reviews given by users.
weight   
Type: number
The weight of the product including the packaging weight.
150
dimension   
Type: object
Dimensions of the product.
length
Type: number
Length of the product.
width
Type: number
Width of the product.
height
Type: number
inventory_management   
Type: string
Allows to manage the inventory of the product.
1
inventory_allow_out_of_stock   
Type: string
By enabling it, order can be placed for the particular product even if it is Out of Stock.
1
inventory_quantity   
Type: number
Required
The total number of product available in the stock for sale.
23
option_set   
Type: string
Option set provides style choices to display different product variants in a more user-friendly manner.
options   
Type: array
The different properties of a product that are used to define product variants.
{
  "options": [
    {
      "name": "Fit Size",
      "values": [
        "S-39",
        "M-40",
        "L-42",
        "XL-44"
      ]
    },
    {
      "name":"Color",
      "values":[
        "red",
        "black",
        "blue"
      ]
    }
  ]
}
name
Type: string
Required
Name of the option.
size
values
Type: array
An array of object that contains possible values of options.
{
"values":["XL","L","XXL"]
}
variants   
Type: custom
variants help to offer choices to customers such as size, color, material etc.
<pre class="language-json"><code>"variants": [
    {
      "price": "449",
      "compare_price": "449",
      "sku": "ONN_CASUALZ_NC431_SMGN_S_1PC_TEst41",
      "inventory_management": "automatic",
      "inventory_quantity": 0,
      "options": [
        {
          "name": "Fit Size",
          "value": "S-39"
        }
      ],
      "variant_id": "S-39",
      "id": 75771,
      "dimension": {}
    },
    {
      "price": "449",
      "compare_price": "449",
      "sku": "ONN_CASUALZ_NC431_SMGN_S_1PC_TEst42",
      "inventory_management": "automatic",
      "inventory_quantity": 0,
      "options": [
        {
          "name": "Fit Size",
          "value": "M-40"
        }
      ],
      "variant_id": "M-40",
      "id": 52863,
      "dimension": {}
    },
    {
      "price": "449",
      "compare_price": "449",
      "sku": "ONN_CASUALZ_NC431_SMGN_S_1PC_TEst43",
      "inventory_management": "automatic",
      "inventory_quantity": 0,
      "options": [
        {
          "name": "Fit Size",
          "value": "L-42"
        }
      ],
      "variant_id": "L-42",
      "id": 62438,
      "dimension": {}
    },
    {
      "price": "449",
      "compare_price": "449",
      "sku": "ONN_CASUALZ_NC431_SMGN_S_1PC_TEst44",
      "inventory_management": "automatic",
      "inventory_quantity": 0,
      "options": [
        {
          "name": "Fit Size",
          "value": "XL-44"
        }
      ],
      "variant_id": "XL-44",
      "id": 88296,
      "dimension": {}
    }
  ]</code></pre>
attributes   
Type: array
Attributes specify different properties of the product as key-value pairs.
{
  "attributes": 
  [
    {
    "name":"size",
    "value":"XL"
    },
   {
     "name":"color",
     "value":"red"
   }
  ]
}

name
Type: string
Required
Name of the attribute.
value
Type: string
Required
Value of the attribute.
group
Type: string
Group of the attribute.
features   
Type: array
Features are used to specify the few unique selling features of the product.
{
  "feature":["feature1","feature2"]
}
channel_categories   
Type: string
SEO   
Type: object
SEO contains data that affects the online visibility of a product on search engine.
{
  "SEO": {
    "title": "Get cotton fabric shirt for just Rs 899",
    "description": "Beautiful floral shirt at ₹ 899/- Same day delivery. No shipping cost.",
     "keywords": "Floral shirt, cotton shirt"
  }
}
title
Type: string
The title of the product to specify a custom title for the product page for SEO.
Get cotton fabric shirt for just Rs 899
description
Type: string
Specify a custom meta description for the product page for SEO.
Beautiful floral shirt at ₹ 899/- Same day delivery. No shipping cost.
keywords
Type: string
Keywords are used to specify a custom meta keywords for the product page for SEO.
Floral shirt, cotton shirt
canonical_url
Type: string
The canonical URL is used to declare a single page as its source or for duplicate pages to reference their source/originating page.
sitemap_priority
Type: string
Sitemap priority defines the priority of the particular page in your store.
0.3
tax   
Type: custom
This field stores the id of tax created in ms.taxes.
58a3da25f94fb055489cfbc1
publish   
Type: string
Enabling the flag makes the product visible on storefront.
1
sort_order   
Type: number
Sort order is used to set the specific order of the product.
allow_custom_pricing   
Type: string
min_limit_to_buy_this_product   
Type: number
This field holds the minimum limit to buy product.
1
max_limit_to_buy_this_product   
Type: number
This field holds the maximum limit to buy product.
5
files   
Type: array
The downloadable files related to the product displayed on the product page.
file
Type: file
A downloadable file related to the product.
description
Type: string
A short description of the file.
maximum_downloads
Type: integer
shipping_cost   
Type: string
Shipping cost for the product is specified here.
100
tag   
Type: string
Tag is used to relate product variants to images.
is_catalog   
Type: string
To enable product catalog.
catalog_only   
Type: string
channels   
Type: custom
google_product_category   
Type: string

Commands (Endpoints)

POST /api/1/entity/ms.products   
Add a new product

Examples

Add a basic product

Request
{
  "name": "Sample Product",
  "price": 20
}
Response
{
  "status": 200,
  "data": {
    "_id": "5c3f3c724b99c515ee8f53d8"
  }
}

Add a new product with single image(from a external url)

Request
{
"data" : {
    "name": "kia Seltos",
    "alias": "kia-seltos",
    "sku": "dummy",
    "price": 950000,
    "publish": "1",
    "inventory_quantity": 1,
    "inventory_management": "none",
    "images": [
         {   "image" : { 
                	"data": "https://img.gaadicdn.com/images/carexteriorimages/630x420/Kia/Kia-Seltos/6232/1561024700599/front-left-side-47.jpg",
                    "uploadType" : "url",
                    "type": "image/jpeg",
                    "name": "car1.jpg"     
         
         }
        }
    	],
    "approve": "approved",
    "seller": "5c11d491c9b06766f1bf76a4",
    "weightunit": "kg"
}
}
Response
{
    "_id": "5d78a2d9cbe1ee658c8b326a"
}

Add a new product with multiple image(from a external url)

Request
{
"data" : {
    "name": "kia Seltos",
    "alias": "kia-seltos",
    "sku": "dummy",
    "price": 950000,
    "publish": "1",
    "inventory_quantity": 1,
    "inventory_management": "none",
    "images": [
    	 {   "image" : { 
                	"data": "https://wheelbhp.b-cdn.net/wp-content/uploads/2019/01/kia-sportage-design-front-pc.jpg",
                    "uploadType" : "url",
                    "type": "image/jpeg",
                    "name": "car.jpg"     
         
         }
        },
         {   "image" : { 
                	"data": "https://img.gaadicdn.com/images/carexteriorimages/630x420/Kia/Kia-Seltos/6232/1561024700599/front-left-side-47.jpg",
                    "uploadType" : "url",
                    "type": "image/jpeg",
                    "name": "car1.jpg"     
         
         }
        }
    	],
    "approve": "approved",
    "seller": "5c11d491c9b06766f1bf76a4",
    "weightunit": "kg"
}
}
Response
{
    "_id": "5d78a34fcbe1ee658c8b354d"
}

add a new product with category

Request
{
"data" : {
    "name": "shirt",
    "alias": "shirt",
    "sku": "shirt11",
    "price": 950,
    "categories": ["children-wear"],
    "publish": "1",
    "inventory_quantity": 1,
    "inventory_management": "none",
    "images": [
    	],
    "approve": "approved",
    "seller": "5c11d491c9b06766f1bf76a4"
	
}
}
Response
{
    "_id": "5d78e64598dd84266b340b0d"
}
GET /api/1/entity/ms.products   
Retrieves a list of products

Examples

List based on sku

Request
q={"uniquesku":"testsku"}
Response
{
  "messages": [
    {
      "name": "ms.entity.products.list",
      "level": "success",
      "key": "ms.entity.products.list",
      "message": ""
    }
  ],
  "data": [
    {
      "_id": "59798ff7d97535bb034ca5dc",
      "publish": "1",
      "alias": "puma-shoes",
      "name": "Puma Shoes",
      "categories": [
        "men",
        "shoes"
      ],
      "price": 5.20,
      "compare_price": 9.28,
      "sku": "testsku",
      "seller": "59730ee332640c7e2be337fb",
      "approve": "approved",
      "inventory_quantity": 0
    }
  ],
  "paging": {
    "limit": 50,
    "start": 0,
    "count": 1
  }
}
GET /api/1/entity/ms.products/_/updateProductBySku   
This API is used to update a product or its variant by using its SKU.
sku
price
compare_price
weight
inventory_quantity

Examples

updateProductBySku

Request
{
  "data":{
    "inventory_quantity": 5
  }
}
Response
{
    "data":"Updated Successfully"
}