Hi Guys,
I've got a simple api controller like so:
public class MailingListApiController : UmbracoApiController
{
public string GetAllRecipients()
{
return Json.Encode(new string[] { "Table", "Chair", "Desk", "Computer", "Beer fridge" });
}
}
in my app_start folder I have webapiconfig.cs:
public static class WebApiConfig
{
public static void Register(HttpConfiguration config)
{
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
var appXmlType = config.Formatters.XmlFormatter.SupportedMediaTypes.FirstOrDefault(t => t.MediaType == "application/xml");
config.Formatters.XmlFormatter.SupportedMediaTypes.Remove(appXmlType);
}
}
which removes the XML formatter
i have checked that it is called in global.asax
But my controller is still returning xml.. just wondering if anyone could suggest how to get this working..
Cheers