0
I don’t work with ASP.NET Core Apis until I need it for a project written in C#. So I created with a standard project, with the following controller:
[Route("api/[controller]")]
[ApiController]
public class MetadataProcessController : ControllerBase {
...
...
// GET api/MetadataProcess/5
[HttpGet("{filename}")]
public ActionResult<string> Get(string filename)
{
return "Hello " + filename;
}
// POST api/MetadataProcess
[HttpPost]
public ActionResult<string> Post([FromBody] string value)
{
return "Hello " + value;
}
...
...
}
Making call using Get
through the URL /api/MetadataProcess/algumaCoisa
the result obtained is Hello algumaCoisa
in the browser.
However, by calling Post
using Postman, encoding the following entry:
Response is a Json error:
I tried to insert other values into value
, but nothing went right. What could I be doing wrong? I would like to receive in Sponse a Hello +
what was sent in the request.