Skip to content

Instantly share code, notes, and snippets.

@mabasic
Created March 5, 2017 15:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mabasic/acd638280aa7b41eabf2d1c737b8cc83 to your computer and use it in GitHub Desktop.
Save mabasic/acd638280aa7b41eabf2d1c737b8cc83 to your computer and use it in GitHub Desktop.
API Blueprint for Bookstore
FORMAT: 1A
# Bookstore
Bookstore is a simple API which allows consumers to view all books and create new ones.
## Group Book
Resources related to books in the API.
### Book collection [/books]
This resource allows you to view a list of books and create a new book.
#### View all books [GET]
This actions returns all books in JSON format.
+ Response 200 (application/json)
{
"data": [
{
"id": 1,
"title": "A Collection of Laravel Tutorials",
"author": "Mario Bašić"
},
{
"id": 2,
"title": "12 Steps for a brighter tomorrow",
"author": "Mario Bašić"
}
]
}
#### Create a new book [POST]
You may create a new book using this action. It takes a JSON
object containing a title and an author.
+ title (string) - The title of the book.
+ author (string) - Name of the author.
+ Request (application/json)
{
"title": "The answer to everything",
"author": "Mario Bašić",
}
+ Response 201 (application/json)
{
"id": 3,
"title": "The answer to everything",
"author": "Mario Bašić",
}
### Book [/books/{book_id}]
This resource allows you to view a single book.
+ Parameters
+ book_id (number) - The ID of the book you want to view.
#### View a single book [GET]
This actions returns a book in JSON format.
+ Response 200 (application/json)
{
"id": 3,
"title": "The answer to everything",
"author": "Mario Bašić",
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment