Library API (1.0.0)

Download OpenAPI specification:Download

The Library API is intended to illustrate typical requirements of RESTful web services. It can be used to manage various books.

Books

Endpoints concerning books

Create a new book.

Request Body schema: application/json

The data necessary to create a book.

isbn
required
string^(978-?|979-?)?\d{1,5}-?\d{1,7}-?\d{1,6}-?\d{...
title
required
string [ 1 .. 300 ] characters
author
required
string [ 1 .. 100 ] characters

Responses

Request samples

Content type
application/json
{
  • "isbn": "string",
  • "title": "string",
  • "author": "string"
}

Response samples

Content type
application/json
{
  • "id": 0
}

Get all books ordered by id and optionally filtered.

query Parameters
query
string [ 1 .. 30 ] characters

Term to look for in all attributes.

page
required
integer >= 1

Number of page to retrieve.

per_page
required
integer [ 1 .. 50 ]

Number of records per page.

Responses

Response samples

Content type
application/json
{
  • "maximumPage": 1,
  • "items": [
    ]
}

Get a book by its id.

path Parameters
id
required
integer >= 0

The id of the book to retrieve.

Responses

Response samples

Content type
application/json
{
  • "id": 0,
  • "isbn": "string",
  • "title": "string",
  • "author": "string"
}

Update a book by its id.

path Parameters
id
required
integer >= 0

The id of the book to update.

Request Body schema: application/json

The data necessary to update a book.

isbn
string^(978-?|979-?)?\d{1,5}-?\d{1,7}-?\d{1,6}-?\d{...
title
string [ 1 .. 300 ] characters
author
string [ 1 .. 100 ] characters

Responses

Request samples

Content type
application/json
{
  • "isbn": "string",
  • "title": "string",
  • "author": "string"
}

Response samples

Content type
application/json
{
  • "messages": [
    ]
}

Delete a book by its id.

query Parameters
id
required
integer >= 0

Id of the book to delete.

Responses

Response samples

Content type
application/json
{
  • "message": "string"
}