以下是我的代码:
$http({
url: 'https://apistage.dealsignal.com/api/v0/company_watchlists/' + wishlist_id,
method: 'PATCH',
params: {
list: {
add_company_ids: ['61737'],
name: 'My Wishlist'
},
api_key: 'CtxY3Kpc7ZDL8VDfLmPt9wss'
}
})
.success(function(response) {
console.log(response);
}).
error(function(response) {
console.log(response);
return false;
});
我遇到了错误的请求错误,但是使用补丁方法的相同请求在 chrome 上的 REST CLIENT 中工作。
最佳答案
请参阅Angular Doc .这将是数据而不是参数。
$http({
url: 'https://apistage.dealsignal.com/api/v0/company_watchlists/' + wishlist_id,
method: 'PATCH',
data: {
list: {
add_company_ids: ['61737'],
name: 'My Wishlist'
},
api_key: 'CtxY3Kpc7ZDL8VDfLmPt9wss'
}
}).success(function(response) {
console.log(response);
}).
error(function(response) {
console.log(response);
return false;
});
关于javascript - Angular JS 中使用 Patch 方法的 HTTP 请求问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32584031/