1
you can design the API to accept both types as shown below but HTTP doesn't allow 2 content types at the same time, so you will have to make 2 requests.
-
[HttpPost("post.{format}"), FormatFilter]
public int Post([FromBody]Employee employee)
{
// do yr work
}
http://localhost:1234/api/employees/Post.json
http://localhost:1234/api/employees/Post.XML
0
https://www.c-sharpcorner.com/article/combine-xml-and-json-requests-and-responses-in-asp-net-core-web-api/
https://andrewlock.net/formatting-response-data-as-xml-or-json-based-on-the-url-in-asp-net-core/