Is POST the right HTTP method/verb to use for telling the server which criteria to use to retrieve data and then save it locally?
I want to send an URL from a client (Windows Forms) app/util to my Web API app to tell it to retrieve data via a Stored Proc, then store the results in a local table. No data is returned to the caller, it's just a notification to do some work.
To prepare for this, I added a new route to WebApiConfig:
// Some reports (monthly) only need a begindate, such as "201509"; others need a range
// of 2..13 months, such as "2001502" and "201602")
config.Routes.MapHttpRoute(
name: "ReportsApi",
routeTemplate: "api/{controller}/{unit}/{begindate}/{enddate}",
defaults: new { enddate = RouteParameter.Optional }
);
In the Controller, this method already existed (was automatically added):
// POST: api/PriceCompliance
public void Post([FromBody]string value)
{
}
...but I don't know if I want the "[FromBody]" jazz, so I added this:
public void Post(String unit, String beginDate, String endDate)
{
// TODO: Call the corresponding SP (via a Model or directly here?) and store the results in a table.
}
Is this the right/better way to do it, or is it preferable to pull the URL args out of "[FromBody]"? In fact, is POST even the right HTTP verb to use for this sort of thing?