I have created a WEB API
using MySQL
Database. The API works as expected for now. I sent a meter serial number and a date time parameter and then G
You can pass a custom model to an action method, but I suggest not using the GET
for you task because GET
does not have a body.
Instead, use the SEARCH
verb and put the list of serials number and the date inside a custom model in the body.
public class MeterSearchModel
{
public List<string> Serials {get;set;}
public DateTime Date {get;set;}
}
In .NET Core 2 your controller would have something like -
[AcceptVerbs("SEARCH")]
public async Task<IActionResult> Search([FromBody] MeterSearchModel model)
{
//..perform search
}