-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
15 lines (15 loc) · 9.43 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>apiary</title>
</head>
<body>
<script src="https://api.apiary.io/seeds/embed.js"></script>
<script>
var embed = new Apiary.Embed({
apiBlueprint: "FORMAT: 1A\nHOST: https://justdoit-api.herokuapp.com\n\n# JustDoIt\n\n*justdoit* is an API that lets you manage bucketlists.\n\n\n## Signup [/signup]\n\n### Create a new user [POST]\n\nUnregistered users must sign up to use the service. They sign up with first_name, last_name, email and password. Additionally, the password must be confirmed.\n\n+ Request (application/json)\n\n + Body\n\n {\n \"first_name\": \"Jack\",\n \"last_name\": \"Bauer\",\n \"email\": \"jackbauer@gmail.com\",\n \"password\": \"1234567890\",\n \"password_confirmation\": \"1234567890\"\n }\n\n\n+ Response 201 (application/json)\n\n + Body\n\n {\n \"message\": \"User created and logged in\"\n }\n\n\n### Login [/auth/login]\nRegistered users must be logged in to use the service. All endpoints except for **signup** and **login** require that the user is logged in.\n\n### Authenticate a user and generate an authorization token [POST]\n\nBefore a user can make requests to the API, one must be logged in. The login action responds with an authorization token that will be used to authenticate subsequent requests. For a successful login the following parameters must be provided: `email` and `password`.\n\n+ Request (application/json)\n\n + Body\n\n {\n \"email\": \"<email>\"\n \"password\": \"<password>\"\n }\n\n+ Response 200 (application/json)\n\n + Body\n\n {\n \"message\": \"Successfully logged in\",\n \"authorization_token\": \"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo2LCJleHAiOjE0ODA3NjgxMTR9.T2bpTIbMLLqBNT1k_j098H3fu4PhD4fp71ukx9EGCi0\"\n }\n## Logout [/auth/logout]\n\nA logged in user can log out. Logging out deletes the users token.\n\n### Log out a user [GET]\n+ Response 200 (application/json)\n\n + Body\n\n {\n \"message\": \"Successfully logged out\"\n }\n\n + Headers\n\n Authorization: <authorization token>\n\n\n## Bucketlist Collection [/bucketlists/]\n\n### Create a new bucketlist [POST]\n\nUsers can create new bucketlists by supplying a \'name\' parameter. The server responds then with the created bucketlist.\n+ Request (application/json)\n\n + Body\n\n {\n \"name\": \"Watch IMDB top 250\"\n }\n\n + Headers\n\n Authorization: <authorization token>\n\n+ Response 201 (application/json)\n\n + Body\n\n {\n \"id\": 1,\n \"name\": \"Watch IMDB top 250\",\n \"items\": [],\n \"date_created\": \"2016-12-02 12:52:52\",\n \"date_modified\": \"2016-12-02 12:52:52\",\n \"created_by\": 1\n }\n\n### List all bucketlists [GET]\nLists all the bucketlists, with or without the following options:\n- page - the page to the results.\n- limit - the number of results to be returned. Maximum is 100. Default is 20\n- q - the query.\n\n+ Request (application/json)\n\n + Headers\n\n Authorization: <authorization token>\n\n+ Parameters\n + page(optional, int)\n + Default: 1\n + limit(optional, int) the number of results to be displayed\n + Default: 20\n + q(optional, string) the query string\n + Default: \"\"\n\n+ Response 200 (application/json)\n\n + Body\n\n [\n {\n \"id\": 1,\n \"name\": \"Watch IMDB top 250\",\n \"items\": [\n {\n \"id\": 1,\n \"name\": \"The Matrix\",\n \"date_created\": \"2016-12-02 12:52:52\",\n \"date_modified\": \"2016-12-02 12:52:52\",\n \"done\": false\n }\n ],\n \"date_created\": \"2016-12-02 12:52:52\",\n \"date_modified\": \"2016-12-02 12:52:52\",\n \"created_by\": 1\n },\n\n {\n \"id\": 2,\n \"name\": \"Travel the world\",\n \"items\": [],\n \"date_created\": \"2016-12-02 12:52:52\",\n \"date_modified\": \"2016-12-02 12:52:52\",\n \"created_by\": 1\n }\n ]\n\n## Bucketlist Record [/bucketlists/<id>]\n\n### Retrieve a specific bucketlist [GET]\n\nRetrieve a bucketlist based on the given `id`.\n\n+ Request 200 (application/json)\n + Headers\n\n Authorization: <authorization token>\n\n+ Response 201 (application/json)\n\n + Body\n\n {\n \"id\": 1,\n \"name\": \"IMDB Top 250\",\n \"items\": [\n {\n \"id\": 3,\n \"name\": \"The Matrix\",\n \"date_created\": \"2016-12-02 12:52:52\",\n \"date_modified\": \"2016-12-02 12:52:52\",\n \"done\": false\n }\n ],\n \"date_created\": \"2016-12-02 12:52:52\",\n \"date_modified\": \"2016-12-02 12:52:52\",\n }\n\n### Update a bucketlist [PUT]\nUpdate the attributes of a given bucket list\n+ Request 200 (application/json)\n + Headers\n\n Authorization: <authorization token>\n\n + Body\n\n {\n \"name\": \"New Name\"\n }\n\n+ Response 200 (application/json)\n\n + Body\n\n {\n \"id\": 1,\n \"name\": \"New Name\",\n \"items\": [\n {\n \"id\": 3,\n \"name\": \"The Matrix\",\n \"date_created\": \"2016-12-02 12:52:52\",\n \"date_modified\": \"2016-12-02 12:52:52\",\n \"done\": false\n }\n ],\n \"date_created\": \"2016-12-02 12:52:52\",\n \"date_modified\": \"2016-12-02 12:52:52\",\n }\n\n### Delete a bucketlist [DELETE]\n\nThis deletes a given bucketlist\n\n+ Request 200 (application/json)\n + Headers\n\n Authorization: <authorization token>\n\n+ Response 200 (application/json)\n\n + Body\n\n {\n \"message\": \"Bucketlist successfully deleted\"\n }\n## Item Collection [/bucketlists/<id>/items/]\n\n### Create a new Item [POST]\n\nA user can create a new item in any of the bucketlists.\n\n+ Request (application/json)\n + Headers\n\n Authorization: <authorization token>\n\n + Body\n\n {\n \"name\": \"The Matrix\"\n }\n\n+ Response 201 (application/json)\n\n + Body\n\n {\n \"id\": 5,\n \"name\": \"The Matrix\",\n \"date_created\": \"2016-12-02 12:52:52\",\n \"date_modified\": \"2016-12-02 12:52:52\",\n \"done\": false\n }\n\n### List all Items in a bucketlist [GET]\n+ Request (application/json)\n + Headers\n\n Authorization: <authorization token>\n\n+ Response 200 (application/json)\n\n + Body\n\n {\n [\n {\n \"id\": 4,\n \"name\": \"The Matrix 1\",\n \"date_created\": \"2016-12-02 12:52:52\",\n \"date_modified\": \"2016-12-02 12:52:52\",\n \"done\": false\n },\n {\n \"id\": 5,\n \"name\": \"The Matrix 2\",\n \"date_created\": \"2016-12-02 12:52:52\",\n \"date_modified\": \"2016-12-02 12:52:52\",\n \"done\": false\n }\n ]\n }\n\n## Item Record [/bucketlists/<id>/items/<id>]\n\n### Retrieve a single item from a bucketlist [GET]\n+ Request (application/json)\n + Headers\n\n Authorization: <authorization token>\n\n+ Response 200 (application/json)\n\n + Body\n\n {\n \"id\": 5,\n \"name\": \"The Matrix\",\n \"date_created\": \"2016-12-02 12:52:52\",\n \"date_modified\": \"2016-12-02 12:52:52\",\n \"done\": false\n }\n\n### Update an item [PUT]\nTo update an item, supply a \'name\' or \'done\' attribute that will update the resource\n+ Request (application/json)\n + Headers\n\n Authorization: <authorization token>\n\n + Body\n\n {\n \"done\": true\n }\n\n+ Response 200 (application/json)\n + Body\n\n {\n \"id\": 5,\n \"name\": \"The Matrix\",\n \"date_created\": \"2016-12-02 12:52:52\",\n \"date_modified\": \"2016-12-02 12:52:52\",\n \"done\": true\n }\n\n\n\n### Delete an item [DELETE]\nYou can delete an item from the bucketlist by specifying an id\n+ Request (application/json)\n + Headers\n\n Authorization: <authorization token>\n\n+ Response 200 (application/json)\n\n + Body\n\n {\n \"message\": \"List successfully deleted\"\n }\n"
});
</script>
</body>
</html>