The BigCommerce RESTful API makes it easy to integrate your applications with BigCommerce. Important store data such as orders, products, customers, categories, shipments and brands can be retrieved and modified as required.The documentation offered by BigCommerce will help you understand it better and use it to easy up the development of your store: API Documentation
How to see the resources?
First of all, you need to enable the API in your store. Then you will be able to access all the xml files containing the resources of your store. See this video to see how to do it: Easy access to your Bigcommerce API with no programming knowledge needed
Why Python?
"If you don’t know any computer languages, I recommend starting with Python. It is cleanly designed, well documented, and relatively kind to beginners. Despite being a good first language, it is not just a toy; it is very powerful and flexible and well suited for large projects."
from How To Become A Hacker, by Eric S. Raymond
What do you need to begin?
Python 2.3+ python-httplib2 |
http://docs.python.org/install/index.html |
Git | http://help.github.com/win-set-up-git/ |
You will find the module that provides an object-oriented wrapper around the BigCommerce V2 API for use in Python projects or via the Python shell, here:
https://github.com/springmerchant/bigcommerce-api-python
Bring the repository from bigcommerce to your local drive using Git:
git clone git://github.com/springmerchant/bigcommerce-api-python.git
What can you do?
Let's try to get a list of all our categories using Python. Open the Python terminal and be ready to feel like a little hacker. First you need to make sure that you are connecting to the API of your store:
from bigcommerce.api import *Connection.host = 'https://store-12345.mybigcommerce.com' Connection.user = 'admin' Connection.api_key = '22d0556jj0i9uf867fgf86f5e1668cade'
Now we need to access the categories list. Let's take a look at the resources. Open api.py and search for Categories. You can see the two functions that allow us to access the list: get(self) and get_by_id(self, id)
.
To see all the category names we need to use this code:
categories = Categories.get() for c in categories: print c.name
And the list will show up in the terminal:
Prepare yourself to learn more about this precious resource! We'll come back with new lessons.