Recently, I found that web APIs are very popular, and there are various great gods in the park who are already studying them. I saw a series of tutorials on the official asp.net website /. So I plan to keep learning and record the learning process in the blog and share it with you.
After each article, I share the code.
As I was just getting started, I have limited technical capabilities. If you have any questions, let's discuss them.
I. Using Entity Framework Code First to build a database model (I) http://www.cnblogs.com/fzrain/p/3491804.html
2. Use the Repository mode to build the database access layer (2)
Iii. ASP. NET Web Api introduction (III)
4. Implement Model factory, dependency injection, and configuration format (4)
5. Implement http put, POST, GET, and DELETE methods in Web APIs (5)
6. Achieve the connection between resources (6)
7. implement resource paging (7)
8. Security Issues in Web APIs (8)
9. prelude to version changes (9)
10. Version changes of multiple technologies (10)
11. Use ETag to redeem resources (11)
To be continued ......
REST indicates declarative state transition. It represents a simple stateless architecture running on HTTP, and each unique URL represents a resource. When creating a RESTful Service, four basic design principles should be followed:
1. the HTTP method (verb) is used to obtain resources in a uniform way (unified interface for interaction), that is, to retrieve resources using GET, create resources using POST, and update resources using PUT/PATCH, DELETE a resource.
2. Interaction with resources is stateless. Therefore, each request initiated by the client should include all parameters of the HTTP request, context information, and data types returned by the required server.
3. resource identifiers should be defined by Uris. in simple words, only Uris are used for interaction between the server and the client and resources. These Uris can be seen as interfaces provided by RESTful services.
4. Multiple formats such as JSON or/and XML are supported as data transmission formats.
For more information about RESTful services, see: http://www.cnblogs.com/light169/archive/2007/12/31/1021814.html
ASP. NET WEb Api first appeared in ASP. NET MVC4 has a year and a half history so far (for me, I am still a new knowledge o ). It is used to build an HTTP service framework that can be called by various clients (such as browsers, smart phone terminals, and desktop clients. It is not part of the ASP. net mvc framework. It can be used as part of the ASP. NET platform for MVC, Web Form, or as an independent service.
We adhere to the simple and easy-to-understand principle and cover many different features of ASP. NET Web APIs to build our project:
We will create a training system that provides some simple external APIs that allow students to register for different courses, allowing instructors to view the students registered in each course, implement CRUD and more operations between the course and students. In the next chapter, I will show you how to use the database model.
This series will involve some of the following knowledge:
1. Use different routing configurations, controllers, resource associations, format responses, and filters
2. Use NInject for dependency Injection
3. Response pagination results in different formats
4. implement complex CRUD operations on multiple resources
5. Use SSL to ensure security
6. use different technologies to implement the API version (URL version: query string, version header, accept header)
7. achieve resource utilization
Note: In this series, we will useFiddler or PostmanTo send HTTP requests