Problem with HTTP request with fix method in Angular JS

Below is my code:

$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; }); 

I get the wrong request error, but the same request with the patch method works in the REST CLIENT on chrome.

+8
javascript angularjs patch
source share
2 answers

See Angular Doc . These are data not params.

 $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; }); 
+7
source

I'm not sure about this, but there may be a problem in the fact that the params parameter should be called "data", for example, when you make a POST request.

Hope this helps.

+2
source

All Articles