This is an API for a pharmacy checkout system
The following are the available API endpoints for the application:
The application provides a login feature that allows users to authenticate using their username and password.
POST /login/
username
: the username of the user (required)password
: the password of the user (required)
POST /login/
username
: the username of the user (required)password
: the password of the user (required)
{ "username": "john", "password": "password123" }
HTTP/1.1 200 OK
{ "token": "abcd1234efgh5678" }
HTTP/1.1 400 Bad Request
{ "error": "Invalid credentials" }
This endpoint will return an authentication token to be used for subsequent requests.
The following endpoints require an authentication token to be passed in the Authorization
header of the request.
GET /products/
: Retrieve a list of all productsPOST /products/
: Create a new productGET /products/<id>/
: Retrieve a specific productPUT /products/<id>/
: Update a specific productDELETE /products/<id>/
: Delete a specific product
Headers:
Authorization: Token abcd1234efgh5678
GET /categories/
: Retrieve a list of all categoriesPOST /categories/
: Create a new categoryGET /categories/<id>/
: Retrieve a specific categoryPUT /categories/<id>/
: Update a specific categoryDELETE /categories/<id>/
: Delete a specific category
Headers:
Authorization: Token abcd1234efgh5678
GET /orders
- Retrieve a list of all ordersGET /orders/:id
- Retrieve a specific order by its IDPOST /orders
- Create a new orderPUT /orders/:id
- Update an existing orderDELETE /orders/:id
- Cancel an existing order
Headers:
Authorization: Token abcd1234efgh5678
GET /customers
- Retrieve a list of all customersGET /customers/:id
- Retrieve a specific customer by its IDPOST /customers
- Create a new customerPUT /customers/:id
- Update an existing customerDELETE /customers/:id
- Remove a customer
Headers:
Authorization: Token abcd1234efgh5678
POST /checkout
- Create a new checkoutGET /checkout/:id
- Retrieve a specific checkout by its IDPUT /checkout/:id
- Update an existing checkoutDELETE /checkout/:id
- Cancel an existing checkout
Headers:
Authorization: Token abcd1234efgh5678
- Python 3.x
- Django 2.x
- mysqlclient
- libmysqlclient-dev (if you are running on a Linux server)
- Clone the repository:
git clone https://github.com/thegeektets/ilara-health-django
- Install the required packages:
pip install -r requirements.txt
- update database settings on settings.py
- Run migrations to create the necessary tables in the database:
python manage.py makemigrations python manage.py migrate
- Start the development server:
python manage.py runserver
- The application will be available at http://127.0.0.1:8000/
To use the project, you will need to create a superuser by running the following command:
python manage.py createsuperuser
You can then log in to the admin interface at http://127.0.0.1:8000/admin/ and start using the project.
- Make sure you have the correct version of python and pip installed before running the above command.
- Update the settings.py database section with the correct:
database = mydatabase user = mydatabaseuser password = mypassword default-character-set = utf8
- If you are running on a Linux server, it is necessary to install additional dependencies by running:
sudo apt-get install libmysqlclient-dev