Skip to content

mrmuli/live-it

Repository files navigation

live-it

Build Status Coverage Status Code Health license

Introduction:

live-it is a bucket list RESTful API that allows creating and editing of bucket lists -- These are a number of experiences or achievements that a person hopes to have or accomplish during their lifetime.
A quick demo can be viewed here

Dependencies:

  1. Flask
  2. Flask-SQLAlchemy
  3. Python 2.7
  4. flask_httpauth
  5. flask_restful
  6. flask_testing

Installation and Setup:

  • Navigate to your directory choice

  • Clone the repository:

  • Using SSH:
    git@github.com:andela-jmuli/live-it.git

  • Using HTTP
    https://github.com/andela-jmuli/live-it.git

  • Setup a virtualenvironment for dependencies:

    • virtualenv {{ desired name }}
    • Activate your environment
  • cd into folder and run source bin/activate to activate the virtual environment

  • Install the dependencies:

    • pip install -r reqiuirements.txt
  • cd back to the project root

  • Setup the database tables and migrations:

    • python manage.py db init
    • python manage.py db migrate
    • python manage.py db upgrade
  • Run the server via:

    • python manage.py runserver
  • you may user Chrome's extension Postman to view or use api

Usage:

Endpoints

Tables Are Requires Authentication
POST auth/login Log a user in False
POST auth/register Register a new user False
POST /bucketlists/ Create a new bucketlist True
GET /bucketlists/ List all created bucketlists True
GET /bucketlists/id get single bucketlist True
PUT /bucketlists/id update single bucketlist True
DELETE bucketlists/id Delete a single bucketlist True
POST bucketlists/id/items/ Create a new item in a bucketlist True
PUT bucketlists/id/items/item_id Update an item in a bucketlist True
DELETE bucketlists/id/items/item_id Delete an item in a bucketlist True

Use Cases:

Registering a new user:
Ensure the URL points to http://localhost:5000/api/v1/auth/register/ as a POST request:
This is a parameterized request thus you need to provide a name and password

Alt text .

Authenticating a user (Login) Ensure the URL points to http://localhost:5000/api/v1/auth/login/ as a POST request:
This is a parameterized request thus you need to provide a name and password

Alt text

Creating a Bucketlist: Ensure the URL points to http://localhost:5000/api/v1/bucketlists/ as a POST request. This is a parameterized request thus you need to provide a name and optionally description This is also a secure request thus make sure you include the token as a header during this request as below:
The key should be Authorization and the value should be prefixed with Token then [token]: i.e.
Authorization : Token sdvbjsdvnskdvna;scma;scma;cfskvbjrv

Alt text

Listing all bucketlists:
Ensure the URL points to http://localhost:5000/api/v1/bucketlists/ as a GET request.
This is also a secure request thus make sure you include the token as a header during this request.

Alt text

Creating a bucketlist item:
Ensure the URL points to http://localhost:5000/api/v1/bucketlists/bucketlist_id/items as a POST request. You have to ensure you have a bucketlist in order to create an item in it. This is also a parameterized request thus you need to provide an item name and optionally description This is also a secure request thus make sure you include the token as a header during this request.

Alt text

Listing all bucketlists with items:
Ensure the URL points to http://localhost:5000/api/v1/bucketlists/ as a GET request.
This is also a secure request thus make sure you include the token as a header during this request

Alt text

Testing:

To test, run the command tox

Licence:

Check out the License file for more information

Credits:

About

A bucket list REST API built on the flask framework

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages