This is an API for a bucket list service. Specification for the API is shown below.
End Point | Function |
---|---|
POST /auth/login: | Logs a user in |
GET /auth/logout: | Logs a user out |
POST /bucketlists: | Creates a new bucket list |
GET /bucketlists: | Lists all the created bucket lists |
GET /bucketlists/(id): | Gets a single bucket list |
PUT /bucketlists/(id): | Updates this single bucket list |
DELETE /bucketlists/(id): | Deletes this single bucket list |
POST /bucketlists/(id)/items: | Creates a new item in bucket list |
PUT /bucketlists/(id)/items/(item_id): | Updates a bucket list item |
DELETE /bucketlists/(id)/items/(item_id): | Deletes an item in a bucket list |
The JSON data model for a bucket list and a bucket list item is shown below.
{
id: 1,
name: “BucketList1”,
items: [
{
id: 1,
name: “I need to do X”,
date_created: “2015-08-12 11:57:23”,
date_modified: “2015-08-12 11:57:23”,
done: False
}
]
date_created: “2015-08-12 11:57:23”,
date_modified: “2015-08-12 11:57:23”
created_by: “Owner's Name”
}
Json Web Tokens(JWT), Token Based System was used for this API. With this, some end points are not accessible to unauthenticated users. Access control mapping is listed below.
End Point | Publicity |
---|---|
POST /auth/login: | TRUE |
GET /auth/logout: | FALSE |
POST /bucketlists: | FALSE |
GET /bucketlists: | FALSE |
GET /bucketlists/(id): | FALSE |
PUT /bucketlists/(id): | FALSE |
DELETE /bucketlists/(id): | FALSE |
POST /bucketlists/(id)/items: | FALSE |
PUT /bucketlists/(id)/items/(item_id): | FALSE |
DELETE /bucketlists/(id)/items/(item_id): | FALSE |
This API is paginated such that users can specify the number of results they would like to have via a GET parameter
limit
.
Request:
GET https://beebuckets.herokuapp.com/v1/bucketlists?page=2&limit=20
Response:
20 bucket list records belonging to the logged in user starting from the 21st bucket list .
Users can search for bucket list by its name using a GET parameter
q
.
Request:
GET https://beebuckets.herokuapp.com/v1/bucketlists?q=bucket1
Response:
Bucket lists with the string “bucket1” in their name.
This API has only one version for now, and it can be accessed via -
https://beebuckets.herokuapp.com/v1/endpoint
This API is currently hosted on: https://beebuckets.herokuapp.com/
This API is open source and contributions are welcomed. You can clone the Github repository and raise a pull request
for your contributions.
Thank You
Adepoju Adebayo, Software developer at Andela