C# API Exercise - Core Criteria (0.2.2)

Download OpenAPI specification:Download

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

Responses

Response samples

Content type
application/json
[
  • {
    }
]

Get a product

Get a product by ID

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
}