There is a recent blog post after mvc conf which shows how to do it with a
custom action result. Will find the link.

Sent from my Windows Phone
------------------------------
From: Paul McCallick
Sent: Monday, February 07, 2011 8:22 AM
To: [email protected]
Subject: Re: Building web apis / RESTful systems with MVC

We're interested in the simple case of returning JSON or XML based on
headers.  There's an example floating around the .net on how to do this, but
I wouldn't say the code is perfect.



On Sun, Feb 6, 2011 at 9:04 PM, Glenn Block <[email protected]> wrote:

> Hello folks (Ignore this is if you saw it on another list :-) )
>
> We're looking to understand how many folks using MVC are really interested
> in more support for building web apis that are consumed by a multitude of
> clients.
>
> When I say REST in this sense, I don't simply mean returning a JsonResult,
> rather I mean supporting multiple media types like OData, Json, Xml, and say
> Atom all from an MVC controller where the client uses content negotiation /
> accept headers to specify their preferences. Some of these media types might
> also use hypermedia constraints in the representation to allow clients to do
> distributed workflows (If hypermedia sounds like complete techno jibberish,
> don't worry about it :-) ).I am also talking about other HTTP concerns like
> generating ETags / supporting conditional GET and PUT.
>
> All of this IS achievable today in MVC, but you have to do a bunch of work
> like for conneg.
>
> My question is how many of you ARE doing it today, or want to do it but it
> is too painful?
>
> Thanks
> Glenn
>
> --
> You received this message because you are subscribed to the Google Groups
> "Seattle area Alt.Net" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/altnetseattle?hl=en.
>



-- 
--Paul

-- 
You received this message because you are subscribed to the Google Groups
"Seattle area Alt.Net" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/altnetseattle?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Seattle area Alt.Net" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/altnetseattle?hl=en.

Reply via email to