This project is an exciting API Web application built using ASP.NET controllers and CRUD operations. It provides a seamless experience for managing and interacting with pizza data.
- C#
- ASP.NET Core
- Visual Studio Code
To install the project, follow these steps:
- Clone the repository to your local machine.
- Open the project in your preferred IDE.
- Restore the NuGet packages by running the command
dotnet restore
in the terminal. - Build the project by running the command
dotnet build
in the terminal. - Start the API by running the command
dotnet run
in the terminal.
Once the API is running, you can interact with it using the provided API documentation.
- URL:
/api/v1/pizza
- Method: GET
- Description: Retrieves all pizzas from the database.
- Response: JSON array of pizza objects.
- URL:
/api/v1/pizza/{id}
- Method: GET
- Description: Retrieves a specific pizza by its ID.
- Parameters:
id
(path parameter): The ID of the pizza.
- Response: JSON object representing the pizza.
- URL:
/api/v1/pizza
- Method: POST
- Description: Creates a new pizza.
- Request Body: JSON object representing the pizza to be created.
- Response: JSON object representing the created pizza.
- URL:
/api/v1/pizza/{id}
- Method: PUT
- Description: Updates an existing pizza.
- Parameters:
id
(path parameter): The ID of the pizza to be updated.
- Request Body: JSON object representing the updated pizza.
- Response: JSON object representing the updated pizza.
- URL:
/api/v1/pizza/{id}
- Method: DELETE
- Description: Deletes a specific pizza by its ID.
- Parameters:
id
(path parameter): The ID of the pizza to be deleted.
- Response: No content.
- Status Code 404: If a pizza with the specified ID is not found.
- Status Code 400: If the request body is invalid or missing required fields.
- This API does not require authentication or authorization.
Request: GET /api/v1/pizza
Response:
[
{
"id": 1,
"Name": "Margherita",
"IsGlutenFree": true
},
{
"id": 2,
"Name": "Pepperoni",
"IsGlutenFree": false
}
]
Request: GET /api/v1/pizza/1
Response:
{
"id": 1,
"Name": "Margherita",
"IsGlutenFree": true
}
Request: POST /api/v1/pizza
Request Body:
{
"Name": "Hawaiian",
"IsGlutenFree": true
}
Response:
{
"id": 3,
"Name": "Hawaiian",
"IsGlutenFree": true
}
Request: PUT /api/v1/pizza/3
Request Body:
{
"Name": "Hawaiian Deluxe",
"IsGlutenFree": true
}
Response:
{
"id": 3,
"Name": "Hawaiian Deluxe",
"IsGlutenFree": false
}
Request: DELETE /api/v1/pizza/3
Response: No content.
I appreciate all contributions! This project is intended for study purposes only, using the Microsoft Learn platform.