UmbracoAuthorizedApiController unsupported media type
Hi
re: umbraco v12
I've got a controller to handle some backoffice member actions. I'm using UmbracoAuthorizedApiController as the base class for my controller and a simple end point that has a guid as its only parameter.
I'm calling the endpoint using $.ajax (post) from the angular controller but i'm getting an unsupported media error.
I've tried replacing the simple guid parameter with a class with the guid as a property of that class as I've seen suggested in some other posts but no joy.
//[FromBody]: Indicates that a parameter should be deserialized from the request body, typically used in POST and PUT requests.
//[FromQuery]: Indicates that a parameter should be taken from the request's query string.
//[FromRoute]: Indicates that a parameter should be taken from the route data.
//[FromForm]: Indicates that a parameter should be taken from the Form data.
[HttpPost]
[Produces("application/json")]
[Route("items/{id:Int}")]
public async Task<ActionResult<IEnumerable<string>>> GetItems([FromBody] ApiRequest req)
{
return Ok();
}
UmbracoAuthorizedApiController unsupported media type
Hi
re: umbraco v12
I've got a controller to handle some backoffice member actions. I'm using UmbracoAuthorizedApiController as the base class for my controller and a simple end point that has a guid as its only parameter.
I'm calling the endpoint using $.ajax (post) from the angular controller but i'm getting an unsupported media error.
I've tried replacing the simple guid parameter with a class with the guid as a property of that class as I've seen suggested in some other posts but no joy.
Any ideas?
Thanks.
Hi,
You are probably missing [FromBody] attribute
Hi
Actually I did have that but I changed stuff around and it started working, i probably mispelled something :D
Thanks.
is working on a reply...