Java API Responses and Requests Exercise - Extension Criteria (0.2.3)

Download OpenAPI specification:Download

Responses and Requests Extension Criteria

books

Create a book

Add a new book to the list

Request Body schema: application/json
title
required
string
numPages
required
integer
author
required
string
genre
required
string

Responses

Request samples

Content type
application/json
{
  • "title": "A Game of Thrones",
  • "numPages": 780,
  • "author": "George R.R. Martin",
  • "genre": "Fantasy"
}

Response samples

Content type
application/json
{
  • "id": 1,
  • "title": "A Game of Thrones",
  • "numPages": 780,
  • "author": "George R.R. Martin",
  • "genre": "Fantasy"
}

Get all books

Get all books from the list

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get a book

Get a single book by its ID

path Parameters
id
required
integer

Id of the Book

Responses

Response samples

Content type
application/json
{
  • "id": 1,
  • "title": "A Game of Thrones",
  • "numPages": 780,
  • "author": "George R.R. Martin",
  • "genre": "Fantasy"
}

Update a book

Update a books details by its ID.

path Parameters
id
required
integer

The ID of the book to update

Request Body schema: application/json
title
required
string
numPages
required
integer
author
required
string
genre
required
string

Responses

Request samples

Content type
application/json
{
  • "title": "A Game of Thrones",
  • "numPages": 780,
  • "author": "George R.R. Martin",
  • "genre": "Fantasy"
}

Response samples

Content type
application/json
{
  • "id": 1,
  • "title": "A Game of Thrones",
  • "numPages": 780,
  • "author": "George R.R. Martin",
  • "genre": "Fantasy"
}

Delete a book

Remove a book from the list and send that book back to the client

path Parameters
id
required
integer

The ID of the book to update

Responses

Response samples

Content type
application/json
{
  • "id": 1,
  • "title": "A Game of Thrones",
  • "numPages": 780,
  • "author": "George R.R. Martin",
  • "genre": "Fantasy"
}