https://github.com/georgreen/cp2a-bucketlist-application
🕵 ✍ 📝 API for an online BucketList. 📅 📚
https://github.com/georgreen/cp2a-bucketlist-application
api-rest bucketlist flask flask-api flask-restplus python3
Last synced: 4 months ago
JSON representation
🕵 ✍ 📝 API for an online BucketList. 📅 📚
- Host: GitHub
- URL: https://github.com/georgreen/cp2a-bucketlist-application
- Owner: georgreen
- License: mit
- Created: 2017-06-14T19:16:32.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-07-15T18:59:18.000Z (almost 8 years ago)
- Last Synced: 2025-01-08T07:49:25.154Z (5 months ago)
- Topics: api-rest, bucketlist, flask, flask-api, flask-restplus, python3
- Language: Python
- Homepage: https://cp2-bucketlist-prd.herokuapp.com/api/#/
- Size: 5.74 MB
- Stars: 1
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://travis-ci.org/georgreen/CP2A-BucketList-Application) [](https://coveralls.io/github/georgreen/CP2A-BucketList-Application?branch=develop) [](https://www.quantifiedcode.com/app/project/675d48c654bc43aa9936634b72415f36) [](https://www.codacy.com/app/georgreen/CP2A-BucketList-Application?utm_source=github.com&utm_medium=referral&utm_content=georgreen/CP2A-BucketList-Application&utm_campaign=Badge_Grade) [](https://github.com/georgreen/CP2A-BucketList-Application/blob/master/LICENSE) []() [](https://www.python.org/dev/peps/pep-0008/)
# BucketList API ✍
Create an API for an online Bucket List service using Flask.```Bucket list``` can also be refered to as ```things/something to do before you die```. It is possibly derived from the English idiom to kick the bucket. It is used as an informal way or as a slang and it is believed that the idiom comes from method of execution such as hanging. The origin of the word remains unclear. [Read more here.](https://www.quora.com/Why-is-a-bucket-list-called-a-bucket-list) 🤔
- ## API
This App exposes endpoints that allows ```clients/Users``` to manage a bucketlist of their choise.- #### Available Resource Endpoints
|Method | Endpoint | Usage |
| ---- | ---- | --------------- |
|POST| `/api/v1.0/register` | Register a user. |
|POST| `/api/v1.0/login` | Login user.|
|POST| `/api/v1.0/bucketlists/` | Create a new bucket list. |
|GET| `/api/v1.0/bucketlists/` | Get all the created bucket lists. |
|GET| `/api/v1.0/bucketlists/` | Get a single bucket list. |
|PUT| `/api/v1.0/bucketlists/` | Update a single bucket list. |
|DELETE| `/api/v1.0/bucketlists/` | Delete single bucket list. |
|POST| `/api/v1.0/bucketlists//items` | Add a new item to this bucket list. |
|GET| `/api/v1.0/bucketlists//items/` | Get an item from this bucket list. |
|PUT|`/api/v1.0/bucketlists//items/` | Update an item in this bucket list. |
|PATCH|`/api/v1.0/bucketlists//items/` | Patch an item in this bucket list. |
|DELETE|`/api/v1.0/bucketlists//items/` | Delete this single bucket list. |
|GET| `/api/v1.0/bucketlists?limit=10&page=1` | Pagination to get 10 bucket list records.|
|GET| `/api/v1.0/bucketlists?q=travelling bucket` | Search for bucket lists with name like travelling bucket.## Getting Started 🕵
- To run on local machine git clone this project :
```
$ git clone https://github.com/georgreen/CP2A-BucketList-Application.git
```Copy and paste the above command in your terminal, the project will be downloaded to your local machine.
- To consume API in client of choice navigate to:
```
https://cp2-bucketlist-prd.herokuapp.com/api/
```
This link will open up a running version of the project on heroku, a detailed documentation is provided on the site.
### Prerequisites
The application is built using python: flask framework.
>[Flask](http://flask.pocoo.org/) is a microframework for the Python programming language.To Install python checkout:
```
https://www.python.org/
```### Installing
For this section I will assume you have python3 and it's configured on your machine.
Navigate to the folder you cloned and run:- Install Requirements
```
$ pip install -r requirements.txt
```- Configure Environment.
```
$ export APP_SETTINGS="default"
$ export DEV_DATABASE="path to your database"
$ export SECRET="Secret Key Here"
```
> Note replace the value for DEV_DATABASE with real database path and SECRET with a strong string value- Configure database
```
$ python manage.py database init
$ python manage.py database migrate
$ python manage.py database upgrade
```- Run App 🏃🏃
```
$ python manage.py runserver
```
The app should be accessiable via : http://127.0.0.1:5000/### Session Examples
To Follow along with this examples get postman : A powerful GUI platform to make your API requests. [READ MORE HERE](https://www.getpostman.com/)
- Set up postman
- Signup/ register

- Post data in the format below to the register endpoint: ```/api/v1.0/register```
```
{
"username":"geogreen ngunga",
"email":"[email protected]",
"password":"demoPassword12#"
}
```- Login

- Post data in the format below to the login endpoint : ```/api/v1.0/login```
```
{
"email":"[email protected]",
"password":"demoPassword12#"
}
```
- Copy the token returned and add it into the headers as a key pair value of ```Authorization : Bearer [put token here]```
- Create BucketList

- Post data in the format below to the bucketlist endpoint: ```/api/v1.0/bucketlists/```
```
{
"name":"new bucketlist name"
}
```- Get BucketList

- Get data from the bucketlist endpoint: ```/api/v1.0/bucketlists/```- Get one BucketList

- Get data from the bucketlist endpoint: ```/api/v1.0/bucketlists/bucket_id```- Update BucketList

- Put data to the endpoint :```/api/v1.0/bucketlists/bucket_id```
```
{
"name":"new name"
}
```- Delete BucketList

- Delete data at an endpoint:```/api/v1.0/bucketlists/bucket_id```- Add Item to BucketList

- Post data to ```/api/v1.0/bucketlists//items``` in the format:
```
{
"name":"Item name",
"description":"Item description"
}
```- Get Item from BucketList

- Get data from the endpoint:```/api/v1.0/bucketlists//items/```- Update Item from BucketList

- Put data to ```/api/v1.0/bucketlists//items/``` in the format:
```
{
"name":"This will update name",
"description":"This will update description"
}
```- Patch Item from BucketList

- Patch item endpoint ```/api/v1.0/bucketlists//items/ ``` data format:
```
{
"done":"True"
}
```- Delete Item from BucketLists

- Delete item at the endpoint ``` /api/v1.0/bucketlists//items/```- Search for BucketLists

- Get bucketlist by searching ```/api/v1.0/bucketlists//?q=search```
Search can be any sub string to be queried from the resource- Paginate BucketLists

- Get paginated buckets ```/api/v1.0/bucketlists//?limit=2&page=1```
This will get two bucketlists per page, limit can be set to any number of bucketlist required per page; page is the required page 1st, 2nd , 3rd ....etc## Running the tests
```
$ python manage.py test
```
- With Coverage```
$ nosetests --rednose --with-coverage --cover-package=app -v
```- Coding style tests
[Pep8](https://www.python.org/dev/peps/pep-0008/) standards are followed in project.
```
$ pep8 app --count
```## Deployment 🚀
- [Check this out to deploy to heroku](https://devcenter.heroku.com/articles/getting-started-with-python#introduction)
## Built With 🏗 🔨⚒
* [Flask](http://flask.pocoo.org/) - The web framework used
* [Flaskrestplus](https://flask-restplus.readthedocs.io/en/stable/) - Extension for Flask that adds support for quickly building REST APIs.
* [webargs](https://webargs.readthedocs.io/en/latest/) - webargs is a Python library for parsing HTTP request arguments
* [Flask JWT Extended](https://flask-jwt-extended.readthedocs.io/en/latest/) - Extension for Flask that adds support for tokken authentication## Contributing 👍
- Please Fork me! :-)
## Versioning ⚙
- [Checkout our releases](https://github.com/georgreen/CP2A-BucketList-Application/releases)
## Authors 📚
* **Georgreen Mamboleo** - *Initial work* - [Dojo](https://github.com/georgreen/Geoogreen-Mamboleo-Dojo-Project)
## License 🤝
- This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details
## Acknowledgments 👊 🙌 👏 🙏
* [Andela ](https://andela.com/) - We are hiring !
* [Taracha Roger](https://github.com/TheDancerCodes) - Cool Human being.🤓🤓
* [Motivation](https://www.youtube.com/watch?v=dQw4w9WgXcQ) - BEST RESOURCE EVER!!!