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

ParameterMeaningNotes
callbackA JavaScript function to run when the response is receivedOptional 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 loginnameemail address or loginname registered in customer accountImportant: If "Require Login Name” is enabled (default), email based login will not work. This param is required for initial login.
passwordcustomer’s passwordThis param is required for initial login
tokenAccess token ID. This token is provided by the system after successful initial authenticationrequired to confirm established authentication
api_keyUnique API key that is set in the control panelThis 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
{"status":1,"success":"Logged in","token":"58fb1592f0c59b8dc1d5541aebdff8da"}
Example response: Fail
{"status":0,"error":"Login attempt failed!"}

Example authentication check request:

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


Example response:
{
   "status":1,
   "request":"authorized"
}

Account Logout

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

Route: a/account/logout

Method: POST

ParameterMeaningNotes
callbackA JavaScript function to run when the response is receivedOptional 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.

tokenAccess token ID. This token is provided by the system after successful initial authenticationrequired
api_keyUnique API key that is set in the control panelThis 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:
{
   "status":1,
   "success":"Logged out"
}

Customer Account Details

Get basic customer Details.

Route: a/account/account

Method: POST

ParameterMeaningNotes
callbackA JavaScript function to run when the response is receivedOptional 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.

tokenAccess token ID. This token is provided by the system after successful initial authenticationrequired
api_keyUnique API key that is set in the control panelThis 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:
{
   "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

ParameterMeaningNotes
callbackA JavaScript function to run when the response is receivedOptional 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.

tokenAccess token ID. This token is provided by the system after successful initial authenticationrequired
api_keyUnique API key that is set in the control panelThis 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:
{
   "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)

ParameterMeaningNotes
callbackA JavaScript function to run when the response is receivedOptional 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.

tokenAccess token ID. This token is provided by the system after successful initial authenticationrequired
api_keyUnique API key that is set in the control panelThis 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:
{
   "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

ParameterMeaningNotes
callbackA JavaScript function to run when the response is receivedOptional 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.

tokenAccess token ID. This token is provided by the system after successful initial authenticationrequired
firstnameCustomer’s first name32 characters limit
lastnameCustomer’s lastname32 characters limit
emailCustomer’s email address96 characters limit
telephoneCustomer’s telephone number32 characters limit
faxCustomer’s fax number32 characters limit
newsletterSelection to receive a newslettervalues: 1 to receive and 0 to skip
Any otherThere are other parameters possible to be loaded (from extensions) 
api_keyUnique API key that is set in the control panelThis 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:
{
   "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)

ParameterMeaningNotes
callbackA JavaScript function to run when the response is receivedOptional 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.

tokenAccess token ID. This token is provided by the system after successful initial authenticationrequired
api_keyUnique API key that is set in the control panelThis 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:
{
   "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

ParameterMeaningNotes
callbackA JavaScript function to run when the response is receivedOptional 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.

tokenAccess token ID. This token is provided by the system after successful initial authenticationrequired
firstnameCustomer’s first name32 characters limit
lastnameCustomer’s lastname32 characters limit
loginnameCustomer’s loginnameUnique login name between 5 and 64 characters. Required If "Require Login Name” is enabled (default)
emailCustomer’s email address96 characters limit
telephoneCustomer’s telephone number32 characters limit
faxCustomer’s fax number32 characters limit
companyCompany name (optional)32 characters limit
address_1Street Address128 characters limit
address_2Apartment #, Suite #, etc part of address128 characters limit
postcodeZip code or Postal code10 characters limit
cityCity or town name128 characters limit
country_idID of the country based on provided list of countries 
zone_idID for the local zone within a country. This is usually a state or regionThis ID can be received with separate request based on selected country ID
passwordPassword to access login to the account 
confirmConfirmation with the same password as in password field 
agreeThis is a confirmation that user agrees to the site user agreementThis is configured in the admin and can be possibly enabled or disabled. Values: 1 agree or 0 decline
newsletterSelection to receive a newslettervalues: 1 to receive and 0 to skip
Any otherThere are other parameters possible to be loaded (from extensions) 
api_keyUnique API key that is set in the control panelThis 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:
{
   "status": 1,
   "text_message":"Success"
}