I have a breakpoint at SendSMS method, the debugger does not break at this method. How can I call SendSMS method and pass the parameters to test the API.
The browser is displaying a HTTP status 415 (Unsupported Media Type). The reason is an HTTP GET sends data in the URL.
There are a couple of way to pass the data depending on your general design intent. The [FromQuery] attribute tells the server to expect data in the URL querystring.
[HttpGet]
public IActionResult SendSMS([FromQuery]SmsMessage model)
{
return Ok(model);
}
https://localhost:7250/api/SMS?To=123&From=456&Message=Hello
Route parameters are another option. Keep in mind, there is a limit to the URL length so, as mentioned above, an HTTP Post is probably a better approach for sending an SMS message.
Learn Web API REST fundamentals and the testing tools that come with Web API.