API Documentation
Before using Invotide API you should enable it previously, via admin part of your site.
Go to Configuration->Users->API and you'll see a predefined user named "Default".
Edit it - and if there are no API-key you will need to generate it, by pressing the button and set "Status" to enable.
Next, add your IP to list of permittedĀ IP's for API access on IP Addresses tab.API is avaliable via URL like
http://mystore.example.com/index.php?route=api/cart/add
where route is using appropriate controller.
NOTES:
- API users always have customer_id as '0'. And have their own api_id.
- We will us python-requests library for this examples, but the main idea is describing parameters so console curl will be fine enough.
- And in descriptions we willl assume we have "in_" prefix on DB tables.
Firstly, you can and definitely should get token for you session - you'll get cookie file and Invotide server will identify activity by this way.
import requests s = requests.Session() username = 'Default' key='L3MYyzlYMRL8gBcpCm6CdrVarFUXtPORZkJKP7vgaY8M8EIZWOr3EJxq' # Actually, key is 256 character-long s.post( 'http://mystore.example.com/index.php?route=api/login', data={'username':username, 'key':key} ).text
If everything was done right, you'll get json-response with api_token for your session. Check site admin API page, edit API user and open "Sessions" tab - you can see established session.
Now, what can you do with Invotide API?
Login
api/login
Establishing session for API user by key PARAMS:
DATA:
username:username from in_api
key:key from in_api
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/login', params={'api_token':'768ef1810185cd6562478f61d2'}, data={ 'username':username, 'key':key } )
Currency
api/currency
DESCRIPTION:change session currency
PARAMS:
api_token
DATA:
currency:code from table in_currency
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/currency', params={'api_token':'768ef1810185cd6562478f61d2'}, data={'currency':'USD'} )
Cart
api/cart/add
DESCRIPTION:adding product to cart
PARAMS:
api_token
DATA:
product_id:product_id from table in_cart
quantity:quantity from table in_cart
option:option array from table in_cart
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/cart/add', params={'api_token':'768ef1810185cd6562478f61d2'}, data={ 'product_id':'100' 'quantuty':'1' } )
api/cart/edit
DESCRIPTION:edit product quantity in cart
PARAMS:
api_token
DATA:
key:cart_id from table in_cart
quantity:quantity from table in_cart
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/cart/edit', params={'api_token':'768ef1810185cd6562478f61d2'}, data={ 'key':'10' 'quantuty':'2' } )
api/cart/remove
DESCRIPTION:removing product from cart
PARAMS:
api_token
DATA:
key:cart_id from table in_cart
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/cart/remove', params={'api_token':'768ef1810185cd6562478f61d2'}, data={ 'key':'10' } )
api/cart/products
DESCRIPTION:cart content
PARAMS:
api_token
DATA:
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/cart/products', params={'api_token':'768ef1810185cd6562478f61d2'}, data={} )
Coupon
api/coupon
DESCRIPTION:apply existing coupon
PARAMS:
api_token
DATA:
coupon:code from in_coupon;
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/coupon', params={'api_token':'768ef1810185cd6562478f61d2'}, data={ 'coupon':'2222' } )
Customer
api/customer
DESCRIPTION:set customer for current session
PARAMS:
api_token
DATA:
firstname:
lastname:
email:
telephone:
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/customer', params={'api_token':'768ef1810185cd6562478f61d2'}, data={ 'firstname':'Dear', 'lastname':'Customer', 'email':'customer@example.com', 'telephone':'+1 879 2548022'} } )
Voucher
api/voucher
DESCRIPTION:apply existing voucher
PARAMS:
api_token
DATA:
voucher:code from in_voucher;
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/voucher', params={'api_token':'768ef1810185cd6562478f61d2'}, data={ 'voucher':'VOU-7271' } )
api/voucher/add
DESCRIPTION:add new voucher for current session
PARAMS:
api_token
DATA:
from_name:from_name from in_voucher
from_email:from_email from in_voucher
to_name:to_name from in_voucher
to_email:to_email from in_voucher
amount :amount from in_voucher in selected currency
code :code from in_voucher
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/voucher/add', params={'api_token':'768ef1810185cd6562478f61d2'}, data={ 'from_name':'mystore Admin' 'from_email':'admin@example.com' 'to_name':'Dear Customer' 'to_email':'customer@example.com' 'amount':'100' 'code':'VOU-7177' } )
Shipping
api/shipping/address -
DESCRIPTIONIPTION:set shipping address for current session
PARAMS:
api_token
DATA:
firstname
lastname
address_1
city
country_id
zone_id
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/shipping/address', params={'api_token':'768ef1810185cd6562478f61d2'}, data={ 'firstname':'Customer', 'lastname':'Dear', 'address_1':'Somewhere', 'city':'KLD', 'country_id':'RUS', 'zone_id':'KGD' } )
api/shipping/methods
DESCRIPTION:returning avaliable shipping methods
PARAMS:
api_token
DATA:
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/shipping/methods', params={'api_token':'768ef1810185cd6562478f61d2'}, )
api/shipping/method
DESCRIPTION:set shipping method for current session
PARAMS:
api_token
DATA:
shipping_method
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/shipping/method', params={'api_token':'768ef1810185cd6562478f61d2'}, data={ 'shipping_method':'pickup.pickup' } )
Reward
api/reward
DESCRIPTION:
PARAMS:
api_token
DATA:
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/reward', params={'api_token':'768ef1810185cd6562478f61d2'}, data={ } )
api/reward/maximum
DESCRIPTION:
PARAMS:
api_token
DATA:
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/reward/maximum', params={'api_token':'768ef1810185cd6562478f61d2'}, data={ } )
api/reward/available
DESCRIPTION:
PARAMS:
api_token
DATA:
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/reward/avaliable', params={'api_token':'768ef1810185cd6562478f61d2'}, data={ } )
Order
api/order/add
DESCRIPTION:new order by cart content and payment/delivery information has beeen set by current session
PARAMS:
api_token
DATA:
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/order/add', params={'api_token':'768ef1810185cd6562478f61d2'}, )
api/order/edit
DESCRIPTION:
PARAMS:
api_token
DATA:
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/order/edit', params={'api_token':'768ef1810185cd6562478f61d2'}, data={ } )
api/order/delete
DESCRIPTION:
PARAMS:
api_token
DATA:
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/order/delete', params={'api_token':'768ef1810185cd6562478f61d2'}, data={ } )
api/order/info
DESCRIPTION:
PARAMS:
api_token
DATA:
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/order/info', params={'api_token':'768ef1810185cd6562478f61d2'}, data={ } )
api/order/history
DESCRIPTION:
PARAMS:
api_token
DATA:
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/order/history', params={'api_token':'768ef1810185cd6562478f61d2'}, data={ } )
Payment
api/payment/address
DESCRIPTION:set payment address for this session
PARAMS:
api_token
DATA:
firstname
lastname
address_1
city
country_id
zone_id
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/payment/address', params={'api_token':'768ef1810185cd6562478f61d2'}, data={ 'firstname':'Customer', 'lastname':'Dear', 'address_1':'Somewhere', 'city':'KLD', 'country_id':'RUS', 'zone_id':'KGD' } )
api/payment/methods
DESCRIPTION:returning avaliable payment methods
PARAMS:
api_token
DATA:
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/payment/methods', params={'api_token':'768ef1810185cd6562478f61d2'}, )
api/payment/method
DESCRIPTION:setting payment method of avaliable in api/payment/methods
PARAMS:
api_token
DATA:
payment_method
EXAMPLE:session.post( 'http://mystore.example.com/index.php?route=api/payment/method', params={'api_token':'768ef1810185cd6562478f61d2'}, data={ 'payment_method':'bank_transfer' } )