A simple api to a shopping list application
- Creation of users
- Creation of shopping lists
- Addition of items to a shopping list
- Ability to share lists with friends
The documentation for this API can be found at:
Clone this repository
cd path to project directory
pip install virtualenv
pip install virtualenvwrapper-win
mkvirtualenv project-name
setprojectdir .
This will ensure the next time you activate your environment, you will be automatically moved to the directory
workon project-name
All the requirements for the project are located in the requirements.txt file in the project root.
You can automatically install all of them by typing:
pip install -r requirements.txt
python manage.py db init
python manage.py db migrate
python manage.py db upgrade
python manage.py test
First you must export or set the environment variables like so:
set FLASK_APP=run.py
set SECRET=some_random_long_text
set APP_SETTINGS=development
set DATABASE_URL=postgresql://postgres-user:password@localhost/db-name
Then run the application using:
flask run
Access the endpoints using your preferred client e.g. Postman
Resource URL | Method | Description | Requires Token |
---|---|---|---|
/v1/auth/register | POST | User registration | FALSE |
/v1/auth/login | POST | User login | FALSE |
/v1/auth/reset | POST | Generate reset token | FALSE |
/v1/auth/password/<token> | PUT | Reset password | TRUE |
/v1/users | GET | Search users | TRUE |
/v1/users/<user_id> | GET | Get user profile | TRUE |
/v1/users/<user_id> | PUT | Update user profile | TRUE |
/v1/users/<user_id> | DELETE | Deactivate account | TRUE |
/v1/admin/users | GET | Get all users | TRUE |
/v1/admin/users/<user_id> | GET | Get a specific user | TRUE |
/v1/admin/users/<user_id> | DELETE | Delete a specific user | TRUE |
/v1/shopping_lists | POST | Create shopping list | TRUE |
/v1/shopping_lists | GET | Get shopping lists | TRUE |
/v1/shopping_lists/<list_id> | GET | Get a shopping list | TRUE |
/v1/shopping_lists/<list_id> | PUT | Edit a shopping list | TRUE |
/v1/shopping_lists/<list_id> | DELETE | Delete a shopping list | TRUE |
/v1/shopping_lists/<list_id>/items | POST | Create a list item | TRUE |
/v1/shopping_lists/<list_id>/items | GET | Get list items | TRUE |
/v1/shopping_lists/<list_id>/items/<item_id> | GET | Get a list item | TRUE |
/v1/shopping_lists/<list_id>/items/<item_id> | PUT | Edit a list item | TRUE |
/v1/shopping_lists/<list_id>/items/<item_id> | DELETE | Delete a list item | TRUE |
/v1/friends | GET | Get all friends | TRUE |
/v1/friends | POST | Send friend request | TRUE |
/v1/friends/<friend_id> | PUT | Accept friend request | TRUE |
/v1/friends/<friend_id> | DELETE | Delete a list item | TRUE |
/v1/friends/requests | GET | Get friend requests | TRUE |
/v1/shopping_lists/share | GET | Get shared lists | TRUE |
/v1/shopping_lists/share | POST | Share a list | TRUE |
/v1/shopping_lists/share/<list_id> | DELETE | Stop sharing a list | TRUE |
/v1/shopping_lists/share/<list_id>/items | GET | Get shared list items | TRUE |