Difference between revisions of "Get Category and Categories"

From KartRocket API
Jump to: navigation, search
(Response)
(Request)
Line 6: Line 6:
 
Category information can be fetch by making a HTTP GET Request on the following URL:
 
Category information can be fetch by making a HTTP GET Request on the following URL:
  
<pre class="prettyprint">
+
<pre lang="php">
  
 
YOUR_STORE_URL_ON_KARTROCKET.’index.php?route=feed/web_api/category&key=’.WEB_API_KEY. ‘&id=’.CATEGORY_ID;
 
YOUR_STORE_URL_ON_KARTROCKET.’index.php?route=feed/web_api/category&key=’.WEB_API_KEY. ‘&id=’.CATEGORY_ID;

Revision as of 12:25, 22 May 2014

Get Category

Request

Category information can be fetch by making a HTTP GET Request on the following URL:


YOUR_STORE_URL_ON_KARTROCKET.’index.php?route=feed/web_api/category&key=’.WEB_API_KEY. ‘&id=’.CATEGORY_ID;

e.g.; http://test.kartrocket.co/index.php?route=feed/web_api/category &key=1234XYZ&id=1;

Response

You will get the following response to the above GET request.


{
	“success”:true,
	“category”:{
	“id”:”1″,
	“name”:”Accessories”,
	“description”:””,
	“href”:”http://saahil.kartrocket.co/index.php?route=product/category&category_id=1″
	}
}


Parameters Description

key : API Key provided by KartRocket.(Required)

id : Category Id. (Required)

Get Categories

Request

Category information can be fetch by making a HTTP GET Request on the following URL.


YOUR_STORE_URL_ON_KARTROCKET.’index.php?route=feed/web_api/categories&key=’.WEB_API_KEY. ‘&parent=’.CATEGORY_PARENT_ID. ‘&level=’.CATEGORY_LEVEL;

e.g.; http://test.kartrocket.co/index.php?route=feed/web_api/categories &key=1234XYZ&parent=0&level=1;


Response

You will get the following response to the above GET request.


{ “success”:true, “categories”:[ { "category_id":"1", "parent_id":"0", "name":"Accessories", "image":false, "href":"http://test.kartrocket.co/index.php?route=product/category&category_id=1", "categories":null }, { "category_id":"9", "parent_id":"0", "name":"Bindass ", "image":false, "href":"http://test.kartrocket.co/index.php?route=product/category&category_id=9", "categories":null }, { "category_id":"4", "parent_id":"0", "name":"Clothing ", "image":false, "href":"http://test.kartrocket.co/index.php?route=product/category&category_id=4", "categories":null }, { "category_id":"6", "parent_id":"0", "name":"Consumables", "image":false, "href":"http://test.kartrocket.co/index.php?route=product/category&category_id=6", "categories":null } ] }



Parameters Description

key : API Key provided by KartRocket.(Required)

parent : Parent of the category. Used when you want to get subcategories of a particular category. (Optional)

level : Up to which level you want the API to traverse in category tree. (Optional)