I am making an $http GET request to my REST api to get a list of projects. What I want to do is filter the response using the param option to only get projects assigned to a particular person.
var config = {
withCredentials: true,
params: {
AssigneeId: 12423
}
};
$http.get(baseUrl + 'projects', config).then(function successCallback(response) {
//do things on success
}, function errorCallback(response) {
//do things on error
});
The AssigneeId field is a property of the project object. The issue I am having is that the response for the $http.get is an array of JSON objects rendering the param useless. My response looks something like this:
[{
ProjectName: 'project 1',
AssigneeId: 12311,
size: 5
}, {
ProjectName: 'project 2',
AssigneeId: 15232,
size: 4
}, {
ProjectName: 'project 3',
AssigneeId: 43123,
size: 2
}, {
ProjectName: 'project 4',
AssigneeId: 12423,
size: 6
}]
What I wanted to do with the param was to only get 'project 4' as a response to my GET request. I think it is not working due to to the response being an array? Or am I doing something wrong?