The Admin API¶
The endpoints which Oscar API exposes by default are mostly suitable for checkout. In other words: For customers who want to buy a product from your webshop. From Oscar API version 1.6 and upwards, an Admin API is also available and exposed. Some usecases for the Admin API are:
- Creating your own admin frontend application and use Oscar as the backend (managing your catalogue, partners etc)
- Use Oscar with the Admin API as a SAAS solution: let other developers and companies integrate Oscar with their products
- Push synchronization of stockrecords / products / categories / partners instead of import scripts etc.
- To enable the admin api, you must first set
Falsein your settings file.
To gain access to the Admin API you will beed to be a staff user (
IsAdminUser in DRF). The
APIAdminPermission (see also Permissions) is used to grant access to the different models in the Admin API and what you can do with them. So if you only have the view and edit permissions for the
Product model you are only allowed to view and edit products. To delete products you need the delete permission as well.
The Admin API is also accessible in the browsable API when your logged in user has access to it. Here you can also test and see how to use the Admin API. Some sophisticated code has been added to make this API pretty straightforward and easy to use.