Skip to content

JackWachira/bucketlist-api

Repository files navigation

Build Status Coverage Status Code Health

Bucketlist API

Bucketlist API for an online Bucket List service using Flask.

Features

The API offers the following features:

  1. User log in and register
  2. Listing, Creating, deleting and updating bucketlists.
  3. Creating, deleting and updating of bucketlist items.
  4. Token based authentication for API methods.
  5. Pagination for GET requests.
  6. Search by Bucketlist name.

Usage

A sample request to create a single bucket list is as follows:

POST /api/v1/bucketlists/ HTTP/1.1
Host: localhost:5000
Content-Type: application/x-www-form-urlencoded
token: eyJhbGciOiJIUzI1NiIsImV4cCI6MzE0NjA2NDUwNjMsImlhdCI6MTQ2MDY0NTA2M30.eyJpZCI6OX0._c2r-kwCAbjV9GSHVV1Vw0k2cSSO1pFbnvfvw38BbFk
Cache-Control: no-cache
Postman-Token: 447971b2-9080-cb19-839e-2e0b82cc29b2

name=MyBucketList

{
    "created_by": 1,
    "date_created": "2016-04-15 04:12:35",
    "date_modified": "2016-04-15 04:12:37",
    "id": 26,
    "items": [],
    "name": "MyBucketList"
}

Endpoints

Endpoint Functionality
POST /auth/login Logs a user in
POST /auth/register Register a user
POST /bucketlists/ Create a new bucket list
GET /bucketlists/ List all the created bucketlists
GET /bucketlists/ Get single bucket list
PUT /bucketlists/ Update this bucket list
DELETE /bucketlists/ Delete this single bucket list
POST /bucketlists//items/ Create a new item in bucket list
PUT /bucketlists//items/<item_id> Update a bucket list item
DELETE /bucketlists//items/<item_id> Delete an item in a bucket list

Set up

Clone the repository and do the following from the root folder:

  1. Create a virtual environment by running the command virtualenv env.

  2. Activate the environment using the command source env/bin/activate.

  3. Run pip install -r requirements.txt to install all relevant dependencies.

  4. Initialise database migrations by running python migrate.py db init

  5. Migrate the database by running python migrate.py db migrate

  6. Upgrade by running python migrate.py db upgrade

  7. Run the command python run.py to start the server. The application will then be live at http://localhost:5000/

Testing

In the project root folder, run command nosetests.

Acknowledgements

This project is built using functionality from the following 3rd party libraries:

  1. Flask
  2. flask-restful
  3. flask-sqlalchemy
  4. itsdangerous
  5. marshmallow

License

The MIT License

Copyright (c) 2016 Jack Mwangi

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages