MySpace, and Content-Type Negotiation in REST using WCF


Hah!   followup on a hot topic. I posted earlier on content-type negotiation in REST with WCF.  


My buddy Vittorio wrote about MySpace’s kiss-and-tell episode at Mix08.  MySpace has exposed a REST interface for the MySpace resources – see http://developer.myspace.com for more info – and the designers talked about their experience at the MIX08 conference this month. Cool!


But here’s the thing – MySpace wanted to support different content types for the same resource.  Rather than employ Accept headers for content-type negotiation, MySpace elected to use a different URL for a different content-type, on the same resource.  So if you want a representation in JSON, then you tickle a URL that ends in .json.  If you want plain old XML, then you use a URL that ends in .xml. 


That’s one vote, in favor of my viewpoint.   Hah!


This doesn’t settle anything, of course, except that, I’m right again.


Also, one more API to be added to Hanselman’s list.


 

Comments (1)

  1. jonflanders says:

    According to the Ruby/Richardson book – it should be both, a representation should have its own URI – and be retrievable via a Base URI with an Accept request header.

    My guess is that MySpace choose URI is because WCF enables that easily – and doesn’t easily enable the other.