RESTful API for CRUD operations, developed with ASP.NET Core.
Six RESTful APIs for the Game Store web application.
API | Description | URL |
---|---|---|
GET /api/products | Get all products | GET http://localhost:8080/api/products |
GET /api/products/{id} | Get a product by ID | GET http://localhost:8080/api/products/1 |
POST /api/products | Add a new product | POST http://localhost:8080/api/products |
PUT /api/products/{id} | Update a product | PUT http://localhost:8080/api/products/1 |
DELETE /api/products/{id} | Delete a product | DELETE http://localhost:8080/api/products/1 |
POST /api/upload | Upload an image | POST http://localhost:8080/api/upload |
git clone https://github.com/jojozhuang/restful-api-aspnet.git
Open the solution file with Microsoft Visual Studio, compile and run. Access http://localhost:8080/api/products in web browser or PostMan, you should get the following json as response.
[
{
"id":3,
"productName":"Wireless Controller",
"price":19.99,
"image":"http://localhost:8080/images/controller.jpg"
},
{
"id":2,
"productName":"Wii",
"price":269.0,
"image":"http://localhost:8080/images/wii.jpg"
},
{
"id":1,
"productName":"Xbox 360",
"price":299.0,
"image":"http://localhost:8080/images/xbox360.jpg"
}
]
Follow tutorial Deploying ASP.NET RESTful API to Azure to deploy it to Azure.
The available RESTful API on Azure is
For example, call https://gamestore-api.azurewebsites.net/api/products to get all products.
Read portfolio Game Store(Angular) or Game Store(React) to learn how these RESTful APIs are consumed by Angular and React applications.
Read tutorial Building RESTful API with ASP.NET Core to learn how this RESTful API is built.