I am trying to get filtered data from a server using a filtering object that I pass to the server. I managed to get this working with the message:
angular:
var filter: { includeDeleted: true, foo: bar };
$http({ method: 'post', url: 'api/stuff', data: filter });
web api:
public IEnumerable<StuffResponse> Post([FromBody]Filter filter)
{
return GetData(filter);
}
But I do not want to use the message for this, I want to use get. But this does not work:
angular
$http({ method: 'get', url: 'api/stuff', params: filter });
web api
public IEnumerable<StuffResponse> Get([FromUri]Filter filter)
{
return GetData(filter);
}
We also tried to specify the parameters: {filter: filter}. If I try [FromBody] or nothing, the filter will be null. With FromUri I get an object at least - but without data. Any ideas how to solve this without creating input parameters for all filter properties?
source
share