Django Oscar API¶
This package provides a RESTful API for django-oscar, it’s based on django-rest-framework and it exposes most of Oscar’s functionality. You can find the source code on GitHub. If you have any questions or problems using Oscar API, please use the Github issuetracker.
Currently Oscar API is compatbile with python 2.7 / 3.5 / 3.6 and the following django versions:
- Django 1.8: Oscar 1.2.2 / 1.3 / 1.4 and 1.5 (requires djangorestframework<3.7)
- Django 1.10: Osccar 1.4 and 1.5 (requires djangorestframework>=3.4)
- Django 1.11: Osccar 1.5 (requires djangorestframework>=3.4)
See Travis for the current tested platforms.
Please see the installation instructions of Oscar to install Oscar and how to create your own project. Then you can install Oscar API by simply typing:
$ pip install django-oscar-api
Or you could add
django-oscar-api to your project dependencies.
Due to wrong dependency specifications in django-oscar (django-haystack 1.6.1 depends on Django<1.11), and of django-haystack (The django requirements are not correct) you will need to install Oscar API like this if you would like to use Django 1.11 with Oscar 1.5:
$ pip install django-oscar-api[django_1_11]
If you would like to install the current development version, use this:
$ pip install git+https://github.com/django-oscar/django-oscar-api.git
You can use the oscarapi application in an oscar ecommerce site without any customization. See for more information: Use Oscar API out-of-the-box
Play around with the sandbox¶
You can also install Oscar API from source and run the sandbox site to play around a bit. Make sure to create a virtualenv first.
$ mkvirtualenv oscarapi $ git clone https://github.com/django-oscar/django-oscar-api.git $ cd django-oscar-api $ make sandbox # run the server $ python sandbox/manage.py runserver
Now you can browse the API at http://localhost:8000/api. Here you can actually use the API already (a cool feature of django-rest-framework) by using your browser and test which JSON formats you can send/receive.