I am attempting to send a string to my web api like this:
public IList<Product> GetProducts(string myString)
{
IList<Product> retVal = null;
using (var client = GetClient())
{
HttpContent httpContent = new StringContent(myString, Encoding.UTF8, "application/json");
// HTTP POST
HttpResponseMessage response = client.PostAsync("api/products", httpContent).Result;
}
return retVal;
}
In my ProductsController my action method looks like this:
// POST: api/products/filter
[HttpPost("filter")]
public IList<Product> Filter(string filter)
{
}
For some reason the filter param keeps coming in as null. Any ideas why?