/bucket-list-api

Flask REST API for bucketlist app

Primary LanguagePythonMIT LicenseMIT

Build Status Coverage Status

Awesome Bucketlist API

A Bucketlist is a list of items, activities or goals you want to achieve before you "kick the bucket" this is an API to allow you create a new user account, login into your account, create, update, view or delete bucketlists and bucketlist items.

Installation and Set Up

Clone the repo from GitHub:

git clone https://github.com/brayoh/bucket-list-api

Fetch from the develop branch:

git fetch origin develop

Navigate to the root folder:

cd bucketlist-api

Install the required packages:

pip install -r requirements.txt

Initialize, migrate, and upgrade the database:

python manage.py db init
python manage.py db migrate
python manage.py db upgrade

Create .env file for your environmental variables

 touch .env

open .env in your editor and add the following variables

export FLASK_APP=run.py
export ENV=development
export DATABASE_URI="your_database_url"
export TEST_DATABASE_URI="database_url_for_testing"
export SECRET="generate a random string"
export TOKEN_SECRET="generate a random string"

Launching the Program

Run python run.py. You may use Postman for Google Chrome to test the API.

API Endpoints

Resource URL Methods Description Requires Token
/api/v1/auth/register/ POST User registration FALSE
/api/v1/auth/login/ POST User login FALSE
/api/v1/bucketlists/ GET, POST A user's bucket lists TRUE
/api/v1/bucketlists/<id>/ GET, PUT, DELETE A single bucket list TRUE
/api/v1/bucketlists/<id>/items/ GET, POST Items in a bucket list TRUE
/api/v1/bucketlists/<id>/items/<item_id>/ GET, PUT, DELETE A single bucket list item TRUE
Method Description
GET Retrieves a resource(s)
POST Creates a new resource
PUT Updates an existing resource
DELETE Deletes an existing resource

Sample Requests

register a new user

screen shot 2017-08-25 at 07 34 47

login user

screen shot 2017-08-25 at 07 35 34

create a bucket list

screen shot 2017-08-25 at 07 38 02

get all bucket list

screen shot 2017-08-25 at 07 38 38

create a bucket list item

screen shot 2017-08-25 at 07 40 30

get all bucket list items

screen shot 2017-08-25 at 07 41 10

get single bucket list item

screen shot 2017-08-25 at 07 41 34

Testing

To run tests locally, run the following command: nosetests

Built With...