Reputation: 367
I have a spring restful backend, one of the mapping is this:
@RequestMapping("/getPeopleList")
public List<Person> getPeeps(@RequestParam(value="ssid", required=true) Integer ssid){
return Backend.getPeople(ssid);
}
How do i make a request to this api? I am doing this with my angularjs
$http.get(url+'/getPeopleList').success(function(peeps) {
console.log(peeps);
});
but this doesnt work...... I also tried this
$http.get(url+'/getPeopleList/234').success(function(peeps) {
console.log(peeps);
});
The id 234 is a random id but that doesn;'t work either. I get 404 or 400 bad request everytime .
Upvotes: 0
Views: 106
Reputation: 4230
you are asking for @RequestParam
but you are passing @PathVariable
.
Please see their doc.
Just change to :
$http.get(url+'/getPeopleList?ssid=234').success(function(peeps) {
console.log(peeps);
});
Upvotes: 1