I'm attempting to migrate a WebAPI-based app from WebAPI RC to the release version. It takes in some query parameters, and returns ATOM-formatted OData. Since it's a running service, I need to maintain the current behavior.
I've changed the API methods to return a PageResult<T>
with my data in it. According to the Supporting OData Query Options article on MSDN that should be all I need to do, but it's not working. I get the result, but it's always formatted as JSON. I've tried changing the Accept
request header to application/atom+xml
, but it doesn't seem to make any difference.
I've also tried adding the following lines in my WebApiConfig
to no apparent effect:
configuration.EnableQuerySupport();
configuration.Formatters.InsertRange(0, ODataMediaTypeFormatters.Create());
I tried clearing out the existing formatters, just to see what would happen. I just get back 406 Not Acceptable
errors. So it seems like perhaps the OData formatters are not reporting that they can handle the request/response?