I\'m using Angular\'s $http
service to make web api requests. When I use the GET method, the two param values are added to the query string:
//
If your api url is "api/test/heroId/power",
var data = 123+'/Death ray'
$http.put("api/test"+data);
AngularJS send json data and not x-www-form-urlencoded format data. Though you can try the below one:
$http.put("/api/test", { heroId: 123, power : "Death ray" });
With $http.put
, $http.post
or $http.patch
, the config object containing your url parameters goes as the third argument, the second argument being the request body:
$http.put("/api/test", // 1. url
{}, // 2. request body
{ params: { heroId: 123, power : "Death ray" } } // 3. config object
);
$http.put
documentation for reference