DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
  1. DZone
  2. Software Design and Architecture
  3. Integration
  4. ASP.NET Web API Basics

ASP.NET Web API Basics

Jalpesh Vadgama user avatar by
Jalpesh Vadgama
·
Jun. 01, 12 · Interview
Like (0)
Save
Tweet
Share
7.77K Views

Join the DZone community and get the full member experience.

Join For Free
We have seen that now the web is really becoming cross platform, and your services or API can be exposed to any client. Till now one of big challenges was how to choose the platform for this kind of service. There are so many options available like web services, WCF services,Generic Handlers, directly writing responses on aspx page etc. There are plenty of options available and each one has its own pros and cons.  But now we have one simpler answer: the ASP.NET Web API.

What is Web API?

ASP.NET Web API is a framework for building web API on the top of .NET framework. It’s a framework for building and consuming web services that can be use at broad range of clients like browsers,tablets phones etc. You can expose JSON or XML whatever you want to use.

Why use Web API?

Think about a situation where a jQuery script that is making a ajax request and we need some thing who can expose data from the server to the client at that time WEB API can be very handy you can expose server data in XML or JSON form and you can make that call with simple http request. No lengthy code required to call WEB API.

It has following features which could be really useful and handy whenever we are creating service or API for our web application.

  • Modern HTML Programming Model:We can directly access and manipulate http web request with strongly type HTTP model. The same programming model is available on the any HTTP client.
  • Full Support for routes: Web API supports the full set of route capabilities that you have in ASP.NET MVC and ASP.NET Web forms 4.0.
  • Exception Handling : It has full support for exception handling and exception filters so you can handle error in much better way.
  • Authorization: It has various support for authorization. You just need to add [Authorise] on the controller and actions that is needed by it.
  • Custom Validation: Just like model validations we need to add validation attributes to model and our custom validation is ready.
  • Content Negotiation: The client and server can work together to determine the right format for data being returned from API. XML and JSON support are directly provided. You can extend this support by adding your own formatters.

How to install Web API:

If you are having Visual Studio 11 Beta installed on your machine then it will directly will be available as built in project template but If you are using Visual Studio 2010 then you need to install ASP.NET WEB API and ASP.NET 4.0 via web platform installer. You can get ASP.NET Web API installer from the following link.

http://www.asp.net/web-api

That’s it. Hope you like it. Stay tuned more updates.Till then Happy Programming!!
API ASP.NET Web Service Web API

Published at DZone with permission of Jalpesh Vadgama, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Automated Testing With Jasmine Framework and Selenium
  • A Deep Dive Into AIOps and MLOps
  • 5 Steps for Getting Started in Deep Learning
  • Unlock the Power of Terragrunt’s Hierarchy

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: