Application for managing bucketlist, with API as interface
Bucketlist Application API is an application for creating and managing a bucketlist, with available API to perform the actions. Built with flask-restful, it implements token Based Authentication for the API and only methods to register and login are accessible to unauthenticated users. Data is exchanged as JSON.
Application works for both Python 2.7 and 3.*
$ git clone git@github.com:andela-aabdulwahab/bucketlist-api.git
$ cd bucketlist_api
After cloning, create a virtual environment and install the requirements. For Linux and Mac users:
$ virtualenv venv
$ source venv/bin/activate
$ pip install -r requirements
If you are on Windows, then use the following commands instead:
$ virtualenv venv
$ venv\Scripts\activate
(venv) $ pip install -r requirements.txt
- Make migrations by running the following commands.
-python manage.py db init
to create the database for the app. -python manage.py db migrate
to create necessary tables in the database. -python manage.py db upgrade
to apply migrated changes
To run the server use the following command:
python runserver.py
to get the app running
Run python manage.py test
to run test and check coverage
$ POST /v1/auth/register
Register a new user.
The body must contain a JSON object that defines username
and password
fields.
On success a status code 201 is returned. The body of the response contains a JSON object with a valid token for the new user.
On failure status code 400 (bad request) is returned.
$ POST /v1/auth/login
Login an existing user.
The body must contain a JSON object that defines username
and password
fields.
On successful login a status code 201 is returned. The body of the response contains a JSON object with a valid token for the user.
On failure status code 401 (unauthorize) is returned.
$ GET /help/
Get help on API usage
On success a status code 200 is returned. With the body of the response containing help message
Basic Authentication required to access all API listed below. Or status code 401 (unauthorized) is returned.
$ POST /v1/bucketlists/
Create a BucketList.
The body must contain a JSON object that defines name
field and an optional is_public
field.
On success a status code 200 is returned. The body of the response contains a JSON object with a link to the created bucket list endpoint
On failure status code 400 (bad request) is returned.
$ GET /v1/bucketlists/
Get all bucketlist of the User.
On success a status code 200 is returned. The body of the response contains a JSON object containing the bucket lists
On failure status code 404 (Not found) is returned.
$ GET /v1/bucketlists/<id>
Get a specific bucketlist.
On success a status code 200 is returned. The body of the response contains a JSON object containing the bucket list
On failure status code 404 (Not found) is returned.
$ PUT /v1/bucketlists/<id>
Update the bucket list specified.
The body must contain a JSON object that defines the field(s) to be modified.
On success a status code 201 is returned. On failure status code 404 (Not found) is returned.
$ DELETE /bucketlists/<id>
Delete the specified bucket list.
On success a status code 201 is returned. On failure status code 404 (Not found) is returned.
$ POST /bucketlists/<id>/items/
Create an item in a Bucket list.
The body must contain a JSON object that defines name
field and an optional done
field.
On success a status code 200 is returned. The body of the response contains a JSON object with a link to the created bucket list endpoint
On failure status code 400 (bad request) is returned.
- PUT /bucketlists/<id>/items/<item_id>
Update the specified item in the bucketlist
The body must contain a JSON object that defines the field(s) to be modified.
On success a status code 201 is returned. On failure status code 404 (Not found) is returned or 401(unauthorize) if bucketlist doesn't belong to the user.
- DELETE /bucketlists/<id>/items/<item_id>
Delete the specified item in the bucket list.
On success a status code 201 is returned. On failure status code 404 (Not found) is returned or 401(unauthorize) if bucketlist doesn't belong to the user.