El-balde is an API for bucket list design. It exposes an API allowing consumers to create and manage bucket lists. This API provides endpoints for the following operations.
Documentation - https://elbalde.herokuapp.com/
Endpoints - https://elbalde.herokuapp.com/api/v1
Source code - https://github.com/andela-amagana/el-balde
- User authentication with JSON Web Tokens JWT Introduction to JWT
- Create a new bucket list
- List all the created bucket lists
- Get single bucket list
- Update this bucket list
- Delete this single bucket list
- Create a new item in bucket list
- List all the created items in a bucket list
- Get a single item in a bucket list
- Update a bucket list item
- Delete an item in a bucket list
- Paginate requests with parameters page and limit e.g.
/bucketlists?page=2&limit=5
- Search bucket lists by name with parameter q e.g.
/bucketlists?q=chall
- Ruby RVM or Homebrew
- PostgreSQL
- Bundler
- Ruby on Rails
- RSpec
1. git clone https://github.com/andela-amagana/el-balde.git
2. cd el-balde
3. bundle install
4. rake db:migrate
5. rake db:seed
6. rails server
1. cd el-balde
2. rspec
All endpoints except POST /users
and POST /auth/login
require an authentication token for Authorization
, failure to which the API will return the error.
{
"error": "Invalid request."
}
An Authorization
token takes the format below.
{
"auth_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0LCJleHAiOjE0ODExMDE2NDYsImlzcyI6ImVsLWJhbGRlIiwiYXVkIjoiY2xpZW50In0.7U7NMCR8ea2Pv6ykozMNRwRHlLT6aFhPXpebOI8rTzw",
"message": "Login successful."
}
EndPoint | Functionality |
---|---|
POST /users | Register a user |
GET /users/:id | View a single user |
PUT /users/:id | Update a user |
DELETE /users/:id | Delete a user |
POST /auth/login | Logs a user in |
GET /auth/logout | Logs a user out |
POST /bucketlists/ | Create a new bucket list |
GET /bucketlists/ | List all the created bucket lists |
GET /bucketlists?page=2&limit=3 | List 3 bucket lists from page 2 |
GET /bucketlists?q=chall | Search for bucket lists containing string chall in their name |
GET /bucketlists/:id | Get single bucket list |
PUT /bucketlists/:id | Update this bucketlist |
DELETE /bucketlists/:id | Delete this single bucket list |
POST /bucketlists/:id/items/ | Create a new item in bucket list |
GET /bucketlists/:id/items | List all the created items in a bucket list |
GET /bucketlists/:id/items?page=2&limit=3 | List 3 bucket list items from page 2 |
GET /bucketlists/:id/items/:item_id | Get a single item in a bucket list |
PUT /bucketlists/:id/items/:item_id | Update a bucket list item |
DELETE /bucketlists/:id/items/:item_id | Delete an item in a bucket list |
Request GET /bucketlists/1/items?page=1&limit=2
http://elbalde.herokuapp.com/api/v1/bucketlists/1/items?page=1&limit=2
Authorization: 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0LCJleHAiOjE0ODExMDE2NDYsImlzcyI6ImVsLWJhbGRlIiwiYXVkIjoiY2xpZW50In0.7U7NMCR8ea2Pv6ykozMNRwRHlLT6aFhPXpebOI8rTzw'
Response (application/json)
[
{
"id": 1,
"name": "North pole",
"date_created": "2016-11-30 9:53:16",
"date_modified": "2016-11-30 10:03:56",
"done": true
},
{
"id": 2,
"name": "South pole",
"date_created": "2016-11-30 9:53:25",
"date_modified": "2016-11-30 9:53:25",
"done": false
}
]
- JWT tokens are invalidated by reference to persisted generated tokens.
- COR is not supported.
- Rate limiting is not supported.