1- #ASP.NET Core WebApi Sample
1+ #ASP.NET Core WebApi Sample with HATEOAS, Versioning & Swagger
22
33In this repository I want to give a plain starting point at how to build a WebAPI with ASP.NET Core.
44
5- This repository contains a controller which is dealing withhouses . You can GET/POST/PUT/PATCH and DELETE them.
5+ This repository contains a controller which is dealing withFoodItems . You can GET/POST/PUT/PATCH and DELETE them.
66
77Hope this helps.
88
99See the examples here:
1010
11- ##GET all houses
11+ ##Versions
1212
13- ``` http://localhost:29435/api/house ```
13+ ``` http://localhost:29435/swagger ```
14+
15+ ![ ASPNETCOREWebAPIVersions] ( ./.github/versions.jpg )
16+
17+ ##GET all Foods
18+
19+ ``` http://localhost:29435/api/v1/foods ```
1420
1521![ ASPNETCOREWebAPIGET] ( ./.github/get.jpg )
1622
17- ##GET singlehouse
23+ ##GET singlefood
1824
19- ``` http://localhost:29435/api/house/1 ```
25+ ``` http://localhost:29435/api/v1/foods/2 ```
2026
2127![ ASPNETCOREWebAPIGET] ( ./.github/getSingle.jpg )
2228
23- ##POST ahouse
29+ ##POST afoodItem
2430
25- ``` http://localhost:29435/api/house ```
31+ ``` http://localhost:29435/api/v1/foods ```
2632
2733``` javascript
2834 {
29- " street" : " MyNewStreet" ,
30- " city" : " MyHomeTown" ,
31- " zipCode" : 1234
35+ " name" : " Lasagne" ,
36+ " type" : " Main" ,
37+ " calories" : 3000 ,
38+ " created" : " 2017-09-16T17:50:08.1510899+02:00"
3239 }
3340```
3441
3542![ ASPNETCOREWebAPIGET] ( ./.github/post.jpg )
3643
3744##PUT a house
3845
39- ``` http://localhost:29435/api/house /5 ```
46+ ``` http://localhost:29435/api/v1/foods /5 ```
4047
4148``` javascript
4249{
43- " id " : 5 ,
44- " street " : " HAAALELUJAH " ,
45- " city " : " HAAALELUJAH-TOWN " ,
46- " zipCode " : 1234657
50+ " name " : " Lasagne2 " ,
51+ " type " : " Main " ,
52+ " calories " : 3000 ,
53+ " created " : " 2017-09-16T17:50:08.1510899+02:00 "
4754}
4855```
4956
@@ -52,19 +59,19 @@ See the examples here:
5259
5360##PATCH a house
5461
55- ``` http://localhost:29435/api/house/4 ```
62+ ``` http://localhost:29435/api/v1/foods/5 ```
5663
5764``` javascript
5865[
59- {" op" : " replace" ," path" : " /street " ," value" : " PatchStreet " }
66+ {" op" : " replace" ," path" : " /name " ," value" : " mynewname " }
6067]
6168```
6269
6370![ ASPNETCOREWebAPIGET] ( ./.github/patch.jpg )
6471
6572##DELETE a house
6673
67- ``` http://localhost:29435/api/house ```
74+ ``` http://localhost:29435/api/v1/foods/5 ```
6875
6976
7077![ ASPNETCOREWebAPIGET] ( ./.github/delete.jpg )