public void PostImport([FromBody]string file)
{}
By debugging I have entered method and see that file is always null, used a number of different requests, one of these should work (have also tried both with capital a for Application/json)? :
C:\>curl -X POST -H "Content-Type: application/json" -d "{\"\":\"myStr\"}" http://localhost:61393/api/admin/import
and
C:\>curl -X POST -H "Content-Type: application/json" -d "{\"file\":\"myStr\"}" http://localhost:61393/api/admin/import
My routes are set up as below
config.Routes.MapHttpRoute(
name: "DefaultApi",
routeTemplate: "api/{controller}/{id}",
defaults: new { id = RouteParameter.Optional }
);
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional }
);