I wrote a custom method on an Angular resource in my application to activate the user. The API endpoint is /users/activate , and the activation code must be set to this endpoint. This is what my resource looks like:
app.factory('User', ['$resource', function($resource){ return $resource('http://api.site.dev/users/:id', {id: '@id'}, { activate: {method:'PUT', params:{code: '@code'}, url: 'http://api.site.dev/users/activate'} }); }]);
and I use it in my controller as follows:
User.activate({code: $routeParams.code});
As you can see from the weblog in Chrome, the activation code is sent to the query string and the request body:

How can I change the resource to just pass the activation code to the request body, and not to the query string?
javascript angularjs rest put api
John dorean
source share