-4

I am using Postman for the first time to POST to a server. I get an error a non-descript body is required.

What should I put in the body? I selected JSON and raw. enter image description here

This is the Angular controller code:

namespace backend.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class QuestionsController : ControllerBase
{
    // POST api/values
    [HttpPost]
    public void Post([FromBody] string value)
    {
    }
}

}
n-verbitsky
  • 552
  • 2
  • 9
  • 20
James
  • 45
  • 2
  • 9

2 Answers2

0

A POST request contains a payload (data which we want to be saved via this POST request). In postman, we need to send that through the request body. Add the JSON/data (in the acceptable signature) to be saved through the request in the request body.

Learning
  • 1,333
  • 16
  • 24
0

I found the answer here

The body is :

"{  \"key1\": \"value1\" }"
James
  • 45
  • 2
  • 9