In WCF you use automaticFormatSelectionEnabled=true/falseĀ to tell it to parse the header to work out what type of response to send back. I'm not sure whether it is the same in WebAPI. It seems a bit ugly to do via a querystring parameter.
________________________________ From: Greg Keogh <[email protected]> To: ozDotNet <[email protected]> Sent: Monday, 20 January 2014 3:03 PM Subject: Web API response formatting Folks, what is the recommended way of letting the caller choose the format of the response? I have a method that can return plain text or XML, so how does the caller choose the one they want? I could have a &format= parameter on the method call (Rackspace do that), or is it better to inspect the Accept header and obey it? Or something else? Greg K
