Java API Exercise - Extension Criteria (0.2.3)

Download OpenAPI specification:Download

Java API MVC in-memory List Extension Criteria

products

Create a product

Add a new product to our list of available products

Request Body schema: application/json
name
required
string
category
required
string
price
required
integer

Responses

Request samples

Content type
application/json
{
  • "name": "How to build APIs",
  • "category": "Book",
  • "price": 1500
}

Response samples

Content type
application/json
{
  • "id": 1,
  • "name": "How to build APIs",
  • "category": "Book",
  • "price": 1500
}

Get all products

Get all of the products from our list

query Parameters
category
string

Find all products with a given category (case insensitive). If no category parameter is provided, return all products.

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get a specific product

Get a product by ID. Respond with a 404 error message if that product doesn't exist

path Parameters
id
required
integer

The ID of the product to get

Responses

Response samples

Content type
application/json
{
  • "id": 1,
  • "name": "How to build APIs",
  • "category": "Book",
  • "price": 1500
}

Update a product

Update an existing product by ID

path Parameters
id
required
integer

The ID of the product to update

Request Body schema: application/json
name
required
string
category
required
string
price
required
integer

Responses

Request samples

Content type
application/json
{
  • "name": "How to build APIs",
  • "category": "Book",
  • "price": 1500
}

Response samples

Content type
application/json
{
  • "id": 1,
  • "name": "How to build APIs",
  • "category": "Book",
  • "price": 1500
}

Delete a product

Remove a product from our list of products

path Parameters
id
required
integer

The ID of the product to delete

Responses

Response samples

Content type
application/json
{
  • "id": 1,
  • "name": "How to build APIs",
  • "category": "Book",
  • "price": 1500
}