Advanced API Blueprint for Bookstore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FORMAT: 1A | |
# Bookstore Advanced | |
Bookstore is a simple API which allows consumers to view all books and create new ones. | |
## Data Structures | |
### Book | |
+ title: The answer to everything (required) | |
+ author: Mario Bašić (required) | |
## 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ć", | |
} | |
#### Create a new book - JSON schema [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) | |
+ Body | |
{ | |
"title": "The answer to everything", | |
"author": "Mario Bašić", | |
} | |
+ Schema | |
{ | |
"$schema": "http://json-schema.org/draft-04/schema#", | |
"title": "Book", | |
"type": "object", | |
"properties": { | |
"title": { | |
"type": "string" | |
}, | |
"author": { | |
"type": "string" | |
} | |
}, | |
"required": ["title", "author"] | |
} | |
+ Response 201 (application/json) | |
{ | |
"id": 3, | |
"title": "The answer to everything", | |
"author": "Mario Bašić", | |
} | |
#### Create a new book - MSON [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) | |
+ Attributes | |
+ title: The answer to everything (required) | |
+ author: Mario Bašić (required) | |
+ Response 201 (application/json) | |
{ | |
"id": 3, | |
"title": "The answer to everything", | |
"author": "Mario Bašić", | |
} | |
#### Create a new book - MSON + data structure [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) | |
+ Attributes (Book) | |
+ 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ć", | |
} | |
#### View a single book [GET] | |
This actions returns a book in JSON format. | |
+ Relation: self | |
+ 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