I am using .Net Core API 2.1 I have this in my Controller:
[Route("Invoke")]
[HttpPost]
public IActionResult Invoke(Student studentDetails)
{
DetailsResponse objResponse;
if(ModelState.IsValid)
{
objResponse= GetDetails(studentDetails);
}
return OK(objResponse);
}
I am trying to invoke the Invoke action method from Postman with the request body as
{"student": {"name":"John Doe", "age":18, "country":"United States of America"}}
This object is always null in the controller. If i try to invoke the action method from Postman with the request body as
{"name":"John Doe", "age":18, "country":"United States of America"}
Here the object has the data and is working fine. My question is to invoke the action with the root node like shown below
{"student": {"name":"John Doe", "age":18, "country":"United States of America"}}
Is there any possibility to achieve this?