Introduction to the ASP.NET Web API

Sign in to queue

Description

What is REST? and a RESTful API? How does the ASP.NET Web API fit in? How does the ASP.NET Web API work? How can it be consumed by clients such as ASP.NET MVC, Win8/Metro, etc.? In this session, John discusses how to get up and running with the ASP.NET  Web API thorugh practical examples. The ASP.NET Web API is a robust solution that represents the easiest way to extend the reach of your application's and enterprise's data.

Day:

1

Level:

100

Embed

Download

Download this episode

The Discussion

  • User profile image
    Dzejms

    So is the recommended approach for MVC/WebAPI hybrid apps to go back over the wire to your REST API server from your MVC front end?  To me this seems like a situation where a shared domain model compiled separately into two apps makes more sense.  Then you serve HTML to browsers via MVC and JSON to mobile apps or other clients.  Otherwise I'm going from browser, over the network to the MVC server, over the network again (perhaps configured so it doesn't leave the datacenter) to my REST API endpoint, then to the DB, then back over each hop again.  

    Of course I know that SPAs & MVC js frameworks like backbone work nicely with REST APIs.  So ideally you'd skip the MVC part.  I guess I'm just used to the heavier back end tier, not simply shipping objects to a smart js front end.  

    Are there any other ways to integrate MVC & WebAPI?

  • User profile image
    dizzyguy

    @Dzejms:Ditto, I'm wondering the same thing(s).  So, I guess that's the goal of One ASP is to figure out how to tie all of this together properly.  Hopefully someone will confirm...?

  • User profile image
    g6temp

    Ditto again. I've been banging my head trying to figure out the "best" way to architect a system (and the VS solution and projects) that has an ASP.NET MVC 4 front-end for serving HTML/CSS to desktop browsers, while also having an ASP.NET Web API to serve JSON to a mobile-only website, with both projects using the same business and data layers on the back-end. In fact, I even asked a question during this aspConf session, but it got deleted (and, thus, never answered). :(

  • User profile image
    Zako

    Thank you John

  • User profile image
    jopapa

    @g6temp: @Dzejms: It's a good question. We now have many ways (which is a good thing) to serve data and pages. I'll give you my 2 cents on this, for what it's worth. If you are already serving pages through MVC (or planning it) you could use that methodology to load the pages and their initial data. Then use the Web API to for gathering data from the client. This gives you a bit of hybrid scenario but it may yield a better user experience.

    For example, your View is loaded from a server side model and presented to the user. Then you could use the Web API to gathering data as the user interacts with the view. 

    Or you could gather the data on the server and convert it to JSON in the View. Then use Knockout to bind it. After that, all data requests could use the Web API so you don't re-post.

    Or if you could just load an HTML page for the Views (with or without MVC) and use a client side Views, using Knockout (or some other library).

    There are many variations ... it really depends on your team's skills, experience, and what you want to achieve. 

  • User profile image
    Rohit H

    Thanks Jhon,

     

    I hope someone writes a quick pros and cons of going each way.

     

    @rohitharsh

  • User profile image
    Aamir

    Grt

    http://www.aspxtutorial.com

  • User profile image
    Some Guy

    You do realize that only you can hear other people's microphones? Very distracting and frustrating that you keep requesting people turn them off. Surely the solution should lie your end. And as for your cat, I mean come on.

  • User profile image
    rani1984

    Where can we download the source code? I checked on github it gives an error 404.

  • User profile image
    Raju Golla
  • User profile image
    VENKATESAN A

    Hello Sir::

    As i am studied BE (Computer science engg)in sri venkateswara college of engg at Sriperumbudur Chennai, I need help to learn ASP.NET and VB.NET and ADO.NET for my job recqutement ,so Ineed raleted videos and Notes for good Knowlege in framework....

  • User profile image
    Jules

    Interesting Introduction to WebAPI, just like the fun I had with Ruby on Rails. Great advice on use of Fiddler to Test RESTful calls. I like the ASP.MVC/API as a simple way to have both HTML and API exposed services. (Not so convinced on the use of MVC clients though, I think that has created some confusion here) - I am still Keen to use Rich Silverlight Clients into these WebAPI.

    I guess since the WebAPI, is really exposing the raw ORM CRUD level methods will result in the 'business logic' layer moving into the Client layer. If we want the Servers, and Servers in the Cloud to do more centralised Business logic, I would tend to implement and expose WCF services exposed instead. (Also overcomes versioning and data hiding)

Add Your 2 Cents