Storefront API

for mobile and remote access

Introduction

Note

API is currently in a beta mode. Use caution to enable it on live sites and use API key.

AbanteCart storefront API is included in code base distribution starting from version 1.0.0. API is RESTful based with JSON as a primary data document format. API supports both HTTP and HTTPS protocols along with extra security if using API key configured in the control panel of AbanteCart.

API build to provide same features as regular AbanteCart storefront and offer remote or mobile platforms to access shopping cart and perform light weight eCommerce requests.

API includes product (catalog) and customer side support. These includes browsing categories, products, attributes as well as create new customer account, login, add to cart and place orders.

AbanteCart API is optimized to perform light and fast responses to the client’s requests. API rt routes are explicit and start with a/... , example, a/product/product


Enable API:

By default API is disabled. To enable the API, you need to locate Control Panel (admin) settings -> system section and enable API. If you want to restrict public access with secret key you can save it in settings. This key will need to be provided with every API request.


How To Test API.

To make development with AbanteCart API and testing easier we have created a script to help you see how API works. These script includes most of the features and provides examples.

http://demo.abantecart.com/test_api.php

Note

You need to enable API in the demo admin. Demo is reset every 30 min, so you need to reactivate.

You can copy this script to your own installation main directory.

Requests, Parameters and Responses.

Catalog API

Catalog side API provides GET or POST interface to get information about categories, products, manufacturers (brands) and other information related to the products set up in AbanteCart.

Any request can contain GET language parameter. This will switch response data to new language. Example: language=es.

Note

language parameter needs to be passed only one time. It is stored in the session for all next requests.

Get Single Product

You can get all product details by unique product ID.

Route: a/product/product

Method: GET

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

product_id Unique product ID on products table Required parameter
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API

Example request:

http://demo.abantecart.com/index.php?rt=a/product/product&product_id=85

with key: http://demo.abantecart.com/index.php?rt=a/product/product&product_id=85&api_key=[key_string]

Example response:

copy

{
   "product_id":"85",
   "model":"Ck0010",
   "sku":"",
   "location":"",
   "stock_status_id":"1",
   "manufacturer_id":"13",
   "shipping":"1",
   "price":"$45.00",
   "tax_class_id":"1",
   "date_available":"2011-09-01",
   "weight":"0.08",
   "weight_class_id":"5",
   "length":"0.00",
   "width":"0.00",
   "height":"0.00",
   "length_class_id":"0",
   "status":"1",
   "date_added":"2011-09-02 11:48:08",
   "date_modified":"2011-09-07 04:24:25",
   "viewed":"21",
   "sort_order":"0",
   "subtract":"1",
   "minimum":"1",
   "cost":"0.0000",
   "language_id":"1",
   "name":"Forbidden euphoria Eau de Parfum Spray ",
   "meta_keywords":"",
   "meta_description":"",
   "description":"
\r\n\tPossessing an innate confidence and sophistication,
    she is just starting to explore her sexuality. What she doesn't yet know is that she already is every man's fantasy.”,
   "store_id":"0",
   "manufacturer":"Calvin Klein",
   "stock_status":"In Stock",
   "thumbnail":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/image\/thumbnails\/18\/6d\/azdemoproduct351jpg-100054-180x180.jpg",
   "special":false,
   "discounts":[
       
   ],
   "product_price":"45.0000",
   "stock":null,
   "options":{
       "323":{
           "product_option_id":"323",
           "attribute_id":"0",
           "group_id":"0",
           "name":"Fragrance Size",
           "option_value":{
               "669":{
                   "product_option_value_id":"669",
                   "attribute_value_id":"0",
                   "group_id":"0",
                   "name":"1 oz",
                   "sku":"",
                   "price":"0.0000",
                   "prefix":"$",
                   "weight":"0.00000000",
                   "weight_type":"lbs"
               },
               "670":{
                   "product_option_value_id":"670",
                   "attribute_value_id":"0",
                   "group_id":"0",
                   "name":"1.7 oz",
                   "sku":"",
                   "price":"18.0000",
                   "prefix":"$",
                   "weight":"0.00000000",
                   "weight_type":"lbs"
               },
               "671":{
                   "product_option_value_id":"671",
                   "attribute_value_id":"0",
                   "group_id":"0",
                   "name":"3.4 oz",
                   "sku":"",
                   "price":"23.5000",
                   "prefix":"$",
                   "weight":"0.00000000",
                   "weight_type":"lbs"
               }
           },
           "sort_order":"0",
           "element_type":"S",
           "html_type":"selectbox",
           "required":"0"
       }
   },
   "text_stars":"",
   "stars":"",
   "average":0,
   "tags":[
       {
           "tag":"fragrance"
       },
       {
           "tag":"women"
       }
   ]
}

 	
Get Product Resources

You can get all product resource by unique product ID.

Route: a/product/resources

Method: GET

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

product_id Unique product ID on products table Required parameter
resource_type Type of resource to show. Now supported only image type Default image type
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API


Example request:

http://demo.abantecart.com/index.php?rt=a/product/resources&product_id=85

Example response:

copy

{
   "total":3,
   "resources":[
       {
"original":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/resources\/image\/18\/6d\/6.jpg",            "thumb":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/image\/thumbnails\/18\/6d\/azdemoproduct351jpg-100054-45x45.jpg"
       },
       {   "origial":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/resources\/image\/18\/6d\/7.jpg",
"thumb":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/image\/thumbnails\/18\/6d\/azdemoproduct352jpg-100055-45x45.jpg"
       },
       {
"origial":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/resources\/image\/18\/6d\/8.jpg",
"thumb":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/image\/thumbnails\/18\/6d\/azdemoproduct35jpg-100056-45x45.jpg"
       }
   ]
}

 	
Get Related Products

You can get all related products to given product with unique product ID.

Route: a/product/related

Method: GET

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

product_id Unique product ID on products table Required parameter
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API

Example request: http://demo.abantecart.com/index.php?rt=a/product/related&product_id=85

Example response:

copy

{
   "total":2,
   "related_products":[
       {
           "product_id":"83",
           "name":"Armani Code Sport",
           "model":"GRM004",
           "rating":0,
           "stars":"",
           "price":"$37.50",
           "options":[
               
           ],
           "special":null,
           "image":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/image\/thumbnails\/18\/6b\/azdemoproduct32jpg-100021-38x38.jpg",
           "thumb":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/image\/thumbnails\/18\/6b\/azdemoproduct32jpg-100021-120x120.jpg",
           "cart_add_rt":"a\/checkout\/cart"
       },
       {
           "product_id":"84",
           "name":"Armani Code Pour Femme",
           "model":"GRM005",
           "rating":0,
           "stars":"",
           "price":"$30.00",
           "options":{
               "322":{
                   "product_option_id":"322",
                   "attribute_id":"0",
                   "group_id":"0",
                   "name":"Size",
                   "option_value":{
                       "666":{
                           "product_option_value_id":"666",
                           "attribute_value_id":"0",
                           "group_id":"0",
                           "name":"30 ml",
                           "sku":"",
                           "price":"0.0000",
                           "prefix":"$",
                           "weight":"0.00000000",
                           "weight_type":"lbs"
                       },
                       "667":{
                           "product_option_value_id":"667",
                           "attribute_value_id":"0",
                           "group_id":"0",
                           "name":"50 ml",
                           "sku":"",
                           "price":"20.0000",
                           "prefix":"$",
                           "weight":"0.00000000",
                           "weight_type":"lbs"
                       },
                       "668":{
                           "product_option_value_id":"668",
                           "attribute_value_id":"0",
                           "group_id":"0",
                           "name":"75 ml",
                           "sku":"",
                           "price":"32.0000",
                           "prefix":"$",
                           "weight":"0.00000000",
                           "weight_type":"lbs"
                       }
                   },
                   "sort_order":"0",
                   "element_type":"S",
                   "html_type":"selectbox",
                   "required":"0"
               }
           },
           "special":null,
           "image":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/image\/thumbnails\/18\/6b\/azdemoproduct34jpg-100018-38x38.jpg",
           "thumb":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/image\/thumbnails\/18\/6b\/azdemoproduct34jpg-100018-120x120.jpg",
           "cart_add_rt":"a\/product\/product"
       }
   ]
}

 	
Get Product Reviews

You can get product reviews by unique product ID.

Route: a/product/product/review

Method: GET

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

product_id Unique product ID on products table Required parameter
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API

Example request: http://demo.abantecart.com/index.php?rt=a/product/product&product_id=85

Example response:

copy

{
   "average":4,
   "records":"1",
   "page":"1",
   "total":1,
   "rows":[
       {
           "author":"Stefania V",
           "rating":"4",
           "text":"it works very well moisturing and cleaning and unlike many other healthy shampoos it doesn't open the hair platelets too far and therefore doesn't feel so dry and sticky so I can get away without using a conditioner. Great value.",
           "date_added":"07\/09\/2011"
       }
   ]
}

 	
Get Categories

You can get category details and subcategories if available. If category ID or path is provided you will get details for matched category and list (array) of available immediate children.

Route: a/product/category

Method: GET

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

category_id Unique category ID on products table Optional parameter. If not provided all root categories are returned
path list of category IDs from parent to child to represent path to last category. Optional path is separated by “_”. Example: 36_38
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API


Example request: http://demo.abantecart.com/index.php?rt=a/product/category&category_id=36

with key: http://demo.abantecart.com/index.php?rt=a/product/category&category_id=36&api_key=[key_string]

Example response:

copy

{
   "category_id":"36",
   "parent_id":"0",
   "sort_order":"1",
   "date_added":"2011-08-29 10:24:45",
   "date_modified":"2011-08-31 06:29:25",
   "status":"1",
   "language_id":"1",
   "name":"Makeup",
   "meta_keywords":"Makeup",
   "meta_description":"",
   "description":"
\r\n\tAll your makeup needs,
    from foundation to eye shadow in hundreds of different assortments and colors.<\/p>\r\n",
   "store_id":"0",
   "thumbnail":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/image\/thumbnails\/18\/71\/demoproduct04jpg-100124-120x120.jpg",
   "total_products":"7",
   "total_subcategories":"6",
   "subcategories":[
       {
           "name":"Eyes",
           "category_id":"39",
           "sort_order":"0",
           "thumb":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/image\/thumbnails\/18\/72\/demoproduct47png-100136-120x120.png"
       },
       {
           "name":"Lips",
           "category_id":"41",
           "sort_order":"0",
           "thumb":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/image\/thumbnails\/18\/72\/demoproduct083jpg-100134-120x120.jpg"
       },
       {
           "name":"Nails",
           "category_id":"42",
           "sort_order":"0",
           "thumb":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/image\/thumbnails\/18\/72\/demoproduct102jpg-100135-120x120.jpg"
       },
       {
           "name":"Value Sets",
           "category_id":"37",
           "sort_order":"0",
           "thumb":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/image\/thumbnails\/18\/72\/demoproduct112jpg-100137-120x120.jpg"
       },
       {
           "name":"Face",
           "category_id":"38",
           "sort_order":"1",
           "thumb":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/image\/thumbnails\/18\/72\/demoproduct05jpg-100132-120x120.jpg"
       },
       {
           "name":"Cheeks",
           "category_id":"40",
           "sort_order":"9",
           "thumb":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/image\/thumbnails\/18\/72\/demoproduct07jpg-100133-120x120.jpg"
       }
   ]
}

 	
Get Manufacturers

You can get manufacturer details and all manufacturers available. If manufacturer ID is provided you will get details for matched manufacturer and list (array) of available manufacturers if no input is provided.

Route: a/product/manufacturer

Method: GET

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

manufacturer_id Unique manufacturer ID Optional parameter. If not provided all manufacturers are returned
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API

Example request:

http://demo.abantecart.com/index.php?rt=a/product/manufacturer&manufacturer_id=12

Example response:

copy

	{
   "manufacturer_id":"12",
   "name":"Benefit",
   "sort_order":"0",
   "store_id":"0"
}
 	
 	
Get Products With Flexible Filtering

You can get all products assigned to matching category ID, Manufacturer ID, keyword, etc

Note

Filtering is based on jQgrid advanced search concept. You can check more details here:
http://www.trirand.com/jqgridwiki/doku.php?id=wiki:advanced_searching


Route: a/product/filter

Method: GET

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

- Quit filter parameters -
category_id Unique category ID Optional parameter
manufacturer_id Unique manufacturer ID Optional parameter.
keyword Keyword text to be searched in product name, mode or SKU space separated words to be searched
match Identify type of match for keyword based search. Allowed values: any, all or exact

any - result will contain any of the matched keywords separated by space all - all keywords must be present in the result exact - will do matching of whole keyword.

match works only in combination with keyword

Default is exact match

pfrom and pto search for price range from pfrom to pto price Only starting pfrom or finishing price range pto can be specified.
- Advanced filter parameters -
page Show specific page for the result in combination with rows
rows Number or results in one page set default 10
sidx Data result to use for sorting (Sort Index)

Sorting is possible by name, model, price and sort_order

Default sorting is done by sort_order data column.
sord Sorting order direction. Possible values DESC descending and ASC ascending Default ASC sorting order
_search Parameter to identify that advanced search is performed with JSON based filter string. Possible values true or false
filters JSON based string with set of parameters to perform advanced search and filtering. This filter string is based on advanced jGgrid searching. See below
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API

Note

One of following search parameters is required category_id, manufacturer_id or keyword

- Advanced jqGrid based search and filtering: Please refer to page below for more details on advanced filter construction http://www.trirand.com/jqgridwiki/doku.php?id=wiki:advanced_searching


Example requests:

Extract products in category ID 36
http://demo.abantecart.com/index.php?rt=a/product/filter&category_id=36


Extract product for manufacturer with ID 14
http://demo.abantecart.com/index.php?rt=a/product/filter&manufacturer_id=14


Search for product with keyword ab and sort by price.
http://demo.abantecart.com/index.php?rt=a/product/filter&keyword=ab&page=1&rows=10&sidx=price&sort=ACS


Search for product name only with ab as part of the name
http://demo.abantecart.com/index.php?rt=a/product/filter&keyword=a&page=1&rows=10&sidx=price&sord=ACS&_search=true&filters={"groupOp":"AND","rules":[{"field":"name","op":"cn","data":"ab"}]}

Customer API

This is a section of API to provide access to registration, customer login and account access. It is highly recommended to use HTTPS to access this part of API.

Customer Login or authentication confirmation

This API request needs to be done every time customer request to login to get access to customer account or just to confirm that current authentication is still valid and not expired.

Route: a/account/login

Method: POST

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

email or loginname email address or loginname registered in customer account Important: If "Require Login Name” is enabled (default), email based login will not work. This param is required for initial login.
password customer’s password This param is required for initial login
token Access token ID. This token is provided by the system after successful initial authentication required to confirm established authentication
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API

Example logon request:
POST: rt=a/account/login , loginname=testlogin , password=123456789

Example response: Success:

copy

{"status":1,"success":"Logged in","token":"58fb1592f0c59b8dc1d5541aebdff8da"}

 	

Example response: Fail:

copy

{"status":0,"error":"Login attempt failed!"}

 	

Example authentication check request:

POST: rt=a/account/login , token=58fb1592f0c59b8dc1d5541aebdff8da

Example response:

copy

{
   "status":1,
   "request":"authorized"
}
 	
Account Logout

Simple log out request. Token needs to be disregarded from future use.

Route: a/account/logout

Method: POST

 

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

token Access token ID. This token is provided by the system after successful initial authentication required
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API

Example request:
POST: rt=a/account/logout , token=58fb1592f0c59b8dc1d5541aebdff8da

Example response:

copy

{
   "status":1,
   "success":"Logged out"
}

 	
Customer Account Details

Get basic customer Details.

Route: a/account/account

Method: POST

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

token Access token ID. This token is provided by the system after successful initial authentication required
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API

Example request:
POST: rt=a/account/account , token=58fb1592f0c59b8dc1d5541aebdff8da

Example response:

copy

{
   "title":"My Account",
   "customer_id":"14",
   "firstname":"Joe",
   "lastname":"Doe",
   "email":"test@test.com",
   "information":"a\/account\/edit",
   "history":"a\/account\/history",
   "newsletter":"a\/account\/logout"
}
 	
Customer Account History

Get customer order history.

Route: a/account/history

Method: POST

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

token Access token ID. This token is provided by the system after successful initial authentication required
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API

Example request:
POST: rt=a/account/history , token=58fb1592f0c59b8dc1d5541aebdff8da

Example response:

copy

{
   "orders":[
       
   ],
   "total_orders":0
}

 	
Edit Customer Account Details

There are 2 steps to edit and save customer details. First step is to get all required fields and existing data. Second step is to provide data to be updated.

Route: a/account/edit

Method: GET

Get all required and optional fields, values and error messages (if any)

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

token Access token ID. This token is provided by the system after successful initial authentication required
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API

Example request:
GET: rt=a/account/edit&token=2f7f30e3efeb0d73744680ac7c0c11e6

Example response:

copy

{
   "fields":{
       "firstname":{
           "type":"input",
           "name":"firstname",
           "value":"First Name",
           "required":true,
           "error":null
       },
       "lastname":{
           "type":"input",
           "name":"lastname",
           "value":"Last Name",
           "required":true,
           "error":null
       },
       "email":{
           "type":"input",
           "name":"email",
           "value":"test@test.com",
           "required":true,
           "error":null
       },
       "telephone":{
           "type":"input",
           "name":"telephone",
           "value":"435435435",
           "required":true,
           "error":null
       },
       "fax":{
           "type":"input",
           "name":"fax",
           "value":"434543543",
           "required":false
       },
       "newsletter":{
           "type":"selectbox",
           "name":"newsletter",
           "value":"1",
           "required":false
       }
   }
}
 	

Method: POST

Update customer information

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

token Access token ID. This token is provided by the system after successful initial authentication required
firstname Customer’s first name 32 characters limit
lastname Customer’s lastname 32 characters limit
email Customer’s email address 96 characters limit
telephone Customer’s telephone number 32 characters limit
fax Customer’s fax number 32 characters limit
newsletter Selection to receive a newsletter values: 1 to receive and 0 to skip
Any other There are other parameters possible to be loaded (from extensions)  
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API


Example request:
POST: firstname=First+Name , lastname=Last+Name , email=test@test.com , telephone=435435435 , fax=434543543 , rt=a/account/edit , token=2f7f30e3efeb0d73744680ac7c0c11e6

Example response:

copy

{
   "status": 1,
   "text_message":"Success"
}
 	
Customer Registration

There are 2 steps to register new customer and save customer details. First step is to get all required fields and provided earlier data (in case of error). Second step is to provide data to be validated and saved.

Route: a/account/create

Method: GET

Get all required and optional fields, values and error messages (if any)

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

token Access token ID. This token is provided by the system after successful initial authentication required
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API

Example request:
GET: rt=a/account/create&token=2f7f30e3efeb0d73744680ac7c0c11e6

Example response:

copy

{
   "fields":{
       "firstname":{
           "type":"input",
           "name":"firstname",
           "value":null,
           "required":true,
           "error":null
       },
       "lastname":{
           "type":"input",
           "name":"lastname",
           "value":null,
           "required":true,
           "error":null
       },
       "loginname":{
             "type":"input",
             "name":"loginname",
             "value":null,
             "required":true,
             "error":null
        },
       "email":{
           "type":"input",
           "name":"email",
           "value":null,
           "required":true,
           "error":null
       },
       "telephone":{
           "type":"input",
           "name":"telephone",
           "value":null,
           "required":true,
           "error":null
       },
       "fax":{
           "type":"input",
           "name":"fax",
           "value":null,
           "required":false
       },
       "company":{
           "type":"input",
           "name":"company",
           "value":null,
           "required":false
       },
       "address_1":{
           "type":"input",
           "name":"address_1",
           "value":null,
           "required":true,
           "error":null
       },
       "address_2":{
           "type":"input",
           "name":"address_2",
           "value":null,
           "required":false
       },
       "city":{
           "type":"input",
           "name":"city",
           "value":null,
           "required":true,
           "error":null
       },
       "postcode":{
           "type":"input",
           "name":"postcode",
           "value":null,
           "required":false
       },
       "country_id":{
           "type":"selectbox",
           "name":"country_id",
           "options":{
               "FALSE":" --- Please Select --- ",
               "1":"Afghanistan",
               "2":"Albania",
        …
           },
           "value":"223",
           "required":true,
           "error":null
       },
       "zone_id":{
           "type":"selectbox",
           "name":"zone_id",
           "required":true,
           "value":null,
           "error":null
       },
       "password":{
           "type":"password",
           "name":"password",
           "value":null,
           "required":true,
           "error":null
       },
       "confirm":{
           "type":"password",
           "name":"confirm",
           "value":null,
           "required":true,
           "error":null
       },
       "newsletter":{
           "type":"radio",
           "name":"newsletter",
           "value":-1,
           "options":{
               "1":"Yes",
               "0":"No"
           }
       },
       "agree":{
           "type":"checkbox",
           "name":"agree",
           "value":1,
           "checked":null
       }
   },
   "text_agree":"I have read and agree to the Privacy Policy<\/b><\/a>"
}

 	

Loginname note

This will be required only if Require login name setting is ON.

Method: POST

Validate and save new customer information

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

token Access token ID. This token is provided by the system after successful initial authentication required
firstname Customer’s first name 32 characters limit
lastname Customer’s lastname 32 characters limit
loginname Customer’s loginname Unique login name between 5 and 64 characters. Required If "Require Login Name” is enabled (default)
email Customer’s email address 96 characters limit
telephone Customer’s telephone number 32 characters limit
fax Customer’s fax number 32 characters limit
company Company name (optional) 32 characters limit
address_1 Street Address 128 characters limit
address_2 Apartment #, Suite #, etc part of address 128 characters limit
postcode Zip code or Postal code 10 characters limit
city City or town name 128 characters limit
country_id ID of the country based on provided list of countries  
zone_id ID for the local zone within a country. This is usually a state or region This ID can be received with separate request based on selected country ID
password Password to access login to the account  
confirm Confirmation with the same password as in password field  
agree This is a confirmation that user agrees to the site user agreement This is configured in the admin and can be possibly enabled or disabled. Values: 1 agree or 0 decline
newsletter Selection to receive a newsletter values: 1 to receive and 0 to skip
Any other There are other parameters possible to be loaded (from extensions)  
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API

Example request:
POST: firstname=First+Name , lastname=Last+Name , email=test@test.com , telephone=435435435 , fax=434543543 , … rt=a/account/create , token=2f7f30e3efeb0d73744680ac7c0c11e6

Example response:

copy

{
   "status": 1,
   "text_message":"Success"
}
 	

Checkout API

This is a section of API to provide tools to add products to cart, select shipment and payment details and complete the order. It is highly recommended to use HTTPS to access this part of API.

Add or update products in cart (basket)

Ability to add product to the cart with quantity and options. Default response to empty request is the content of the cart. If product and quantity are provided product will be added to the cart. If remove is provided along with valid product key, these products will be removed from the cart

Route: a/checkout/cart

Method: POST

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

token Access token ID. This token is provided by the system after successful initial authentication required
product_id Unique product ID that will be added to the cart  
quantity Number of products to be added to the cart  
option_id Product option ID Options can be provided as an array with multiple combinations of option_id and option_value
option_value Product option value  
remove Array of product keys to be removed from the cart. Product cart key can be found on the cart content data structure. Examples: "key":"85:a10ee6ef6a41d8d2078bc2614fd71296" or "key":"86"
     
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API

Example request:
POST: rt=a/checkout/cart , token=58fb1592f0c59b8dc1d5541aebdff8da

Example response:

copy

{
   "products":[
       {
           "key":"85:a10ee6ef6a41d8d2078bc2614fd71296",
           "name":"Forbidden euphoria Eau de Parfum Spray ",
           "model":"Ck0010",
           "thumb":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/image\/thumbnails\/18\/6d\/azdemoproduct351jpg-100054-75x75.jpg",
           "option":[
               {
                   "name":"Fragrance Size",
                   "value":"1 oz"
               }
           ],
           "quantity":1,
           "stock":true,
           "price":"$45.00",
           "total":"$45.00"
       }
   ],
   "weight":"0.08lb",
   "totals":[
       {
           "title":"Sub-Total:",
           "text":"$45.00",
           "value":45,
           "sort_order":"1"
       },
       {
           "title":"Total:",
           "text":"$45.00",
           "value":45,
           "sort_order":"6"
       }
   ]
}

 	

Example quantity update request:
POST: rt=a/checkout/cart , token=58fb1592f0c59b8dc1d5541aebdff8da, product_id=53, quantity[53:ee705d4ae7846adb2c3e17d441a1009f]=2


Shipping options and selection (First step in checkout)

There are 2 steps to shipping selection. First step is to get all available shipping options and pricing. Second step is to provide user selection.

Note, some products settings might not require shipping, in this case user selection step can be skipped.

Route: a/checkout/shipping

Method: POST

Get all available shipping methods with mode=list

Post users selection of shipping method and comment with mode=select

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

token Access token ID. This token is provided by the system after successful initial authentication required
mode switch to set the mode of this step. Values:

select - Pass user selection for shipping method

list - Get all available shipping methods

shipping_method User selected shipping method ID This is an ID for shipping that is part of shipping_methods structure. Example:

default_free_shipping.default_free_shipping

option_id Product option ID Options can be provided as an array with multiple combinations of option_id and option_value
comment User text based comment Optional
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API

Example request: POST: rt=a/checkout/shipping , mode=list , token=2f7f30e3efeb0d73744680ac7c0c11e6

Example response:

copy

{
   "error_warning":null,
   "address":"First Name Last Name
test
Address 1
Address 2
087901,
    3676 Test City
WI",
   "shipping_methods":{
       "default_free_shipping":{
           "title":"Free Shipping",
           "quote":{
               "default_free_shipping":{
                   "id":"default_free_shipping.default_free_shipping",
                   "title":"Free Shipping",
                   "cost":0,
                   "tax_class_id":0,
                   "text":"$0.00"
               }
           },
           "sort_order":"",
           "error":false
       },
       "default_flat_rate_shipping":{
           "title":"Flat Rate",
           "quote":{
               "default_flat_rate_shipping":{
                   "id":"default_flat_rate_shipping.default_flat_rate_shipping",
                   "title":"Flat Shipping Rate",
                   "cost":"2",
                   "tax_class_id":"9",
                   "text":"$2.00"
               }
           },
           "sort_order":"1",
           "error":false
       }
   },
   "comment":null
}
 	

Example request:

POST: rt=a/checkout/shipping , mode=select , shipping_method=default_free_shipping.default_free_shipping , token=2f7f30e3efeb0d73744680ac7c0c11e6

Example response:

copy

{
   "status":1,
   "shipping_select":"success"
}
 	
Shipping or Billing (payment) selection

There are 2 steps to shipping or billing address selection. First step is to get all available addresses in customer address book. Second step is to provide user selection with existing address ID or completely new address information (will be saved to address book)

Route: a/checkout/address

Method: POST

Get all available addresses and current selection (if already done) with mode=shipping or mode =payment

Post users selection with mode=shipping or mode =payment and action=save

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

token Access token ID. This token is provided by the system after successful initial authentication required
mode switch to set the mode of this step. Values:

shipping - Handle shipping related address

payment - Handle payment (billing) related address

address_id User selected shipping address ID from address book This is address_id for shipping that is part part of response structure in saved_addresses

Works in combination with mode=shipping

payment_address_id User selected payment address ID from address book This is address_id for payment that is part part of response structure in saved_addresses

Works in combination with mode=payment

api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API

Example request:

POST: rt=a/checkout/address , mode=shipping , token=2f7f30e3efeb0d73744680ac7c0c11e6

Example response:

copy

{
   "selected_address_id":"20",
   "saved_addresses":[
       {
           "address_id":"20",
           "address":"First Name Last Name,
            Address 1,
            Test City,
            Wisconsin,
            087901,
            United States"
       }
   ],
   "fields":{
       "firstname":{
           "type":"input",
           "name":"firstname",
           "value":null,
           "required":true,
           "error":null
       },
       "lastname":{
           "type":"input",
           "name":"lastname",
           "value":null,
           "required":true,
           "error":null
       },
       "company":{
           "type":"input",
           "name":"company",
           "value":null,
           "required":false
       },
       "address_1":{
           "type":"input",
           "name":"address_1",
           "value":null,
           "required":true,
           "error":null
       },
       "address_2":{
           "type":"input",
           "name":"address_2",
           "value":null,
           "required":false
       },
       "city":{
           "type":"input",
           "name":"city",
           "value":null,
           "required":true,
           "error":null
       },
       "postcode":{
           "type":"input",
           "name":"postcode",
           "value":null,
           "required":false
       },
       "country_id":{
           "type":"selectbox",
           "name":"country_id",
           "options":{
               "FALSE":" --- Please Select --- ",
               "1":"Afghanistan",
               "2":"Albania",
               "3":"Algeria",
         …..     
           },
           "value":"223",
           "required":true,
           "error":null
       },
       "zone_id":{
           "type":"selectbox",
           "name":"zone_id",
           "required":true,
           "value":null,
           "error":null
       }
   }
}

 	

Method: POST

Validate and save new customer’s address and set it as shipping or payment address

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

token Access token ID. This token is provided by the system after successful initial authentication required
mode switch to set the mode of this step Values:

shipping - Handle shipping related address

payment - Handle payment (billing) related address

firstname Customer’s first name 32 characters limit
lastname Customer’s lastname 32 characters limit
company Company name (optional) 32 characters limit
address_1 Street Address 128 characters limit
address_2 Apartment #, Suite #, etc part of address 128 characters limit
postcode Zip code or Postal code 10 characters limit
city City or town name 128 characters limit
country_id ID of the country based on provided list of countries  
zone_id ID for the local zone within a country. This is usually a state or region This ID can be received with separate request based on selected country ID
Any other There are other parameters possible to be loaded (from extensions)  
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API
Payment options and selection

There are 2 steps to payment method selection. First step is to get all available payment options. Second step is to provide user payment selection. Coupon for discount can also be provided at this stage.

Route: a/checkout/payment

Method: POST

Get all available payment methods with mode=list

Post users selection of payment method and comment with mode=select

Note

Shipping method and Payment address should be selected before this API stage.

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

token Access token ID. This token is provided by the system after successful initial authentication required
mode switch to set the mode of this step Values:

select - Pass user selection for payment method

list - Get all available payment methods

coupon Coupon code to be used to apply available coupon value to total order. Works in combination with any mode.
payment_method User selected payment method ID This is an ID for payment that is part of payment_methods structure.

Example: default_authorizenet_aim

agree Pass return policy confirmation if required based on configuration settings. This is configured in the admin and can be possibly enabled or disabled. Values: 1 agree or 0 decline
comment User text based comment Optional
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API


Example request: POST: rt=a/checkout/payment , mode=list , token=2f7f30e3efeb0d73744680ac7c0c11e6

Example response:

copy

{
   "error_warning":"Error: You must agree to the Return Policy!",
   "success":null,
   "coupon":null,
   "address":"First Name Last Name
test
Address 1
Address 2
087901,
    3676 Test City
WI",
   "payment_methods":{
       "default_cod":{
           "id":"default_cod",
           "title":"Cash On Delivery",
           "sort_order":""
       },
       "default_authorizenet_aim":{
           "id":"default_authorizenet_aim",
           "title":"Credit Card \/ Debit Card (Authorize.Net)",
           "sort_order":""
       }
   },
   "payment_method":null,
   "comment":"",
   "text_agree":"I have read and agree to the Return Policy<\/b><\/a>",
   "agree":null
}

 	
Final confirmation before payment submit

This step it to provide all prepared data for the order back to the user for final confirmation. Once user confirms that details payment details needs to be sent back for final payment processing.

Currently. Only COD and Authorize.Net are supported for payment methods.

IMPORTANT

In the confirmation response, there is a payment array structure that provides required data to complete payment. This data needs to be collected from the user and sent to final process step.

Route: a/checkout/confirm

Method: POST

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

token Access token ID. This token is provided by the system after successful initial authentication required
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API

Example request:

POST: rt=a/checkout/confirm , token=2f7f30e3efeb0d73744680ac7c0c11e6

Response:

copy

{
   "store_id":null,
   "store_name":"Web Store Name",
   "store_url":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/",
   "customer_id":"16",
   "customer_group_id":"8",
   "firstname":"First Name",
   "lastname":"Last Name",
   "email":"test@test1.com",
   "telephone":"435435435",
   "fax":"434543543",
   "shipping_firstname":"First Name",
   "shipping_lastname":"Last Name",
   "shipping_company":"test",
   "shipping_address_1":"Address 1",
   "shipping_address_2":"Address 2",
   "shipping_city":"Test City",
   "shipping_postcode":"087901",
   "shipping_zone":"Wisconsin",
   "shipping_zone_id":"3676",
   "shipping_country":"United States",
   "shipping_country_id":"223",
   "shipping_address_format":"{
       firstname
   } {
       lastname
   }\r\n{
       company
   }\r\n{
       address_1
   }\r\n{
       address_2
   }\r\n{
       city
   },
    {
       zone
   } {
       postcode
   }\r\n{
       country
   }",
   "payment_firstname":"First Name",
   "payment_lastname":"Last Name",
   "payment_company":"test",
   "payment_address_1":"Address 1",
   "payment_address_2":"Address 2",
   "payment_city":"Test City",
   "payment_postcode":"087901",
   "payment_zone":"Wisconsin",
   "payment_zone_id":"3676",
   "payment_country":"United States",
   "payment_country_id":"223",
   "payment_address_format":"{
       firstname
   } {
       lastname
   }\r\n{
       company
   }\r\n{
       address_1
   }\r\n{
       address_2
   }\r\n{
       city
   },
    {
       zone
   } {
       postcode
   }\r\n{
       country
   }",
   "shipping_method":"Free Shipping",
   "payment_method":"Credit Card \/ Debit Card (Authorize.Net)",
   "products":[
       {
           "product_id":"84",
           "name":"Armani Code Pour Femme",
           "model":"GRM005",
           "option":[
               {
                   "product_option_value_id":"669",
                   "name":null,
                   "value":"669",
                   "prefix":null
               }
           ],
           "download":[
               
           ],
           "quantity":2,
           "price":"$30.00",
           "total":"$60.00",
           "tax":0,
           "thumb":"http:\/\/dev01.algozone.net\/abantecart_branch100\/public_html\/image\/thumbnails\/18\/6b\/azdemoproduct34jpg-100018-75x75.jpg"
       }
   ],
   "totals":[
       {
           "title":"Sub-Total:",
           "text":"$60.00",
           "value":60,
           "sort_order":"1"
       },
       {
           "title":"Free Shipping:",
           "text":"$0.00",
           "value":0,
           "sort_order":"3"
       },
       {
           "title":"Retail 8.5%:",
           "text":"$5.10",
           "value":5.1,
           "sort_order":"5"
       },
       {
           "title":"Total:",
           "text":"$65.10",
           "value":65.1,
           "sort_order":"6"
       }
   ],
   "comment":"",
   "total":65.1,
   "language_id":"1",
   "currency_id":"1",
   "currency":"USD",
   "value":"1.00000000",
   "coupon_id":0,
   "ip":"71.127.255.162",
   "shipping_address":"First Name Last Name
test
Address 1
Address 2
087901,
    3676 Test City
WI",
   "payment_address":"First Name Last Name
test
Address 1
Address 2
087901,
    3676 Test City
WI",
   "text_accept_agree":"",
   "payment":{
       "text_credit_card":"Credit Card Details",
       "entry_cc_owner":"Card Owner:",
       "cc_owner":{
           "type":"input",
           "name":"cc_owner",
           "required":true,
           "value":""
       },
       "entry_cc_number":"Card Number:",
       "cc_number":{
           "type":"input",
           "name":"cc_number",
           "required":true,
           "value":""
       },
       "entry_cc_expire_date":"Card Expiry Date:",
       "entry_cc_cvv2":"Card Security Code (CVV2):",
       "cc_cvv2":{
           "type":"input",
           "name":"cc_cvv2",
           "value":"",
           "style":"short",
           "required":true,
           "attr":" size=\"3\""
       },
       "button_confirm":"Confirm Order",
       "button_back":"Back",
       "cc_expire_date_month":{
           "type":"selectbox",
           "name":"cc_expire_date_month",
           "value":"03",
           "options":{
               "01":"January",
               "02":"February",
    …
           },
           "required":true,
           "style":"short"
       },
       "cc_e    xpire_date_year":{
           "type":"selectbox",
           "name":"cc_expire_date_year",
           "value":"2013",
           "options":{
               "2012":"2012",
    …
           },
           "required":true,
           "style":"short"
       },
       "process_rt":"default_authorizenet_aim\/send"
   }
}
 	
Process payment and complete the order

This is a final step in order process.

IMPORTANT

In the confirmation response, there was a payment array structure that provided required data to complete payment. This data needs to be collected from the user and sent to this process step.

Route: a/checkout/process

Method: POST

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

token Access token ID. This token is provided by the system after successful initial authentication required
payment details Details that are returned from confirmation step in payment structure. Required based on “required” flag in the structure
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API

Example request:

POST: rt=a/checkout/process , [ field values ] token=2f7f30e3efeb0d73744680ac7c0c11e6

Response:

copy

{
   "success":"completed",
   "status":1
}

 	

Common DATA API

There is some additional data available via API.

Validate Access to API

You can run this simple request to check if API access is working. You will get error if no access or empty reply if access it OK.

Route: a/common/access

Method: GET

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API

Example request:

http://demo.abantecart.com/index.php?rt=a/common/access&api_key=[key]

Example response:

copy

{"error":"Access to API is disabled!"}

 	
Get Countries

You can get all the countries from the system

Route: a/common/country

Method: GET

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API

Example request: http://demo.abantecart.com/index.php?rt=a/common/country

Get Zones

You can get all the geo zones for specified country ID

Route: a/common/zone

Method: GET

Parameter Meaning Notes
callback A JavaScript function to run when the response is received Optional parameter allows you to specify a JavaScript function to handle query results for pure client-side implementations.

Embed the API query in <script> tags. Define the callback function in <script> tags.

country_id Unique country ID Required
api_key Unique API key that is set in the control panel This is optional key that can be set to limit unauthorized (accidental) access to your API


Example request:

http://demo.abantecart.com/index.php?rt=a/common/zone&country_id=2

Example response:

copy

[
   {
       "zone_id":"33",
       "country_id":"2",
       "code":"BR",
       "name":"Berat",
       "status":"1",
       "sort_order":"0"
   },
   {
       "zone_id":"34",
       "country_id":"2",
       "code":"BU",
       "name":"Bulqize",
       "status":"1",
       "sort_order":"0"
   },
...
]
 	

Related pages: