I have my own API for a small part of the application, divided into two controllers, due to the (external) requirements for the JSON data wrapper in the API (some requests must use camelCasing, while others must use PascalCasing).
Now I have a URL that I want to map to PascalCasing for GET, but camelCasing for PUT, so I tried the following:
[PascalCasing]
public class PascalCasedController : ApiController
{
[HttpGet]
[Route("url/to/my/resource/{id}")]
public IHttpActionResult(int id)
{
return Ok(GetResource(id));
}
}
public class CamelCasedController : ApiController
{
[HttpPut]
[Route("url/to/my/resource/{id}")]
public IHttpActionResult(int id, Resource resource)
{
SaveResource(id, resource);
return Ok();
}
}
The request GETworks as expected, but if I try PUTsomething there with Fiddler, I get the following error message:
, URL. , URL.
:
MyProject.PascalCaseController
MyProject.CamelCaseController
, , , , WebAPI , , HTTP , . , WebAPI, , ?