Introduction to the Web API

Source: Internet
Author: User

The ASP. NET Web API contains the following features: An advanced HTTP programming model that directly operates HTTP requests and responses using the new strongly typed HTTP object model, uses the same programming model and HTTP pipelines on HTTP clients, and supports routing: Web API full support The ASP, including routing parameters and Constraints. In addition, to the Mapping Support Convention of the action, it is no longer necessary to add a property like [HttpPost] to the class or method; The content negotiation: the client and the server can together determine the format of the API return data. The default supports XML, JSON, and form URL-encoded format, can be extended to add custom formats, and even replace the default content negotiation policy; model binding and validation: Model binders can easily extract data from HTTP requests and convert them into action methods . Net objects used; filter: Web API support filtering, including the general known [authorize] filter tags, you can add and insert custom filters for the Action, authentication, exception handling, etc. query aggregation: As long as the simple return Iqueryable< ; T> , the Web API will support querying through OData address conventions, and improved HTTP detail testability: The Web API does not set the HTTP details to a static Context object, but instead uses the HTTPREQUESTMESSAG E and Httpresponsemessage instances, you can use the generic versions of these objects to add custom types for these Http types; improved dependency inversion (IoC) Support: The Web API uses the MVC Dependency Resolver to implement the service locator module To get instances in different scenarios; code-based configuration: The Web API uses code to complete the configuration, ensuring that the configuration file is neat; self--host: The Web API can be hosted in a process, in addition to being managed in IIS, and can still be used with routing and Other features.
Create a Web API program

To this a simple WEBAPI project was created to complete

The methods in the Web API are written uniformly in the controllers controller, and the page is written separately

There are four ways to manipulate data on a page, such as Get, Post, Put, Delete, respectively. Get is get data post is add data put is update data delete is delete data

Introduction to the Web API

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.