Add Products

From KartRocket API
Jump to: navigation, search

Add Product

Request

User can create product by sending a HTTP POST Request on the following URL:


YOUR_STORE_URL_ON_KARTROCKET.'index.php?route=feed/web_api/addproduct&key='.WEB_API_KEY;

Example

http://api.kartrocket.co/index.php?route=feed/web_api/addproduct&key=APITEST

Following is the JSON data format to be posted on above URL. 'data' is the parameter name consisting JSON data to create product. Parameter ‘data’ is critical for the system. System expects 'data' parameter and JSON data has to be sent into it.

data={
   "name":"Product Name", #Required
   "description":"Product Description",
   "meta_title":"Product Meta Title",
   "meta_description":"Product Meta Description",
   "meta_keyword":"Product Meta Keyword",
   "manufacturer":"Manufacturer",
   "sku":"SKU1", #Required and Unique
   "model":"MODEL1", #Required
   "price":"1000", #Required
   "quantity":"20",
   "shipping":"1",
   "subtract":"1",
   "image":"data\/product_main_image.jpg",
   "status":"1",
   "keyword":"product-name",
   "upc":"3253454543",
   "asin":"ASIN34234",
   "isbn":"989687685875",
   "ean":"22334343",
   "weight":"2",
   "length":"10",
   "width":"10",
   "height":"10",
   "tax_class_id":"9",
   "download_images":"1",
   "product_image":[
      "data\/product_image_1.jpg",
      "data\/product_image_2.jpg",
      "data\/product_image_3.jpg",
      "data\/product_image_n.jpg"
   ],
   "product_option":{
      "Option One":[
         {
            "option_name":"Option One Value 1",
            "option_sku":"OOV1", #Required and Unique
            "quantity":"10",
            "price":"1000", #Required
            "weight":"0.6",
            "subtract":"1"
         },
         {
            "option_name":"Option One Value 2",
            "option_sku":"OOV2",
            "quantity":"10",
            "price":"2000",
            "weight":"1.0",
            "subtract":"1"
         },
         {
            "option_name":"Option One Value 3",
            "option_sku":"OOV3",
            "quantity":"10",
            "price":"3000",
            "weight":"1.0",
            "subtract":"1"
         }
      ],
      "Option Two":[
         {
            "option_name":"Option Two Value 1",
            "option_sku":"OTV1",
            "quantity":"10",
            "price":"1000",
            "weight":"0.6",
            "subtract":"1"
         },
         {
            "option_name":"Option Two Value 1",
            "option_sku":"OTV2",
            "quantity":"10",
            "price":"2000",
            "weight":"1.0",
            "subtract":"1"
         }
      ]
   },
   "product_attribute":[
      {
         "group":"Attribute Group 1",
         "name":"Attribute 1",
         "description":"Attribute Value 1"
      },
      {
         "group":"Attribute Group 2",
         "name":"Attribute 2",
         "description":"Attribute Value 2"
      }
   ],
   "product_category":[
      "Category One>Category Two",
      "Category One>Category Three",
      "Category Four"
   ]
}



Response

You will get the following response to the above POST request:

Successful request:
{
   "success":true,
   "product_added":"151" # Product Id
}

Failed request:


{
   "success": false,
   "message":"Respective Error Message."
}


Parameters Description

key : API Key provided by KartRocket.(Required)

product_name : Name of the Product.(Required)

sku : Product SKU. (Required)

price : New price of product. (Required)


Sample File

[View Sample on Github]