jeudi 11 août 2016

REST PATCH failure

For the following code :

updateUser: function(id, user){

            var updateUrl = "/Users/" + id + "/"

            var promise = $http({method:'PATCH', url: updateUrl, data: user, headers: {'segment' : segment, 'Accept': 'application/xml', 'Content-Type': 'application/json' }})
                .error(function(data, status){
                    return {"status":false};
                });

            return promise;
        },

And the REST endpoint:

@RequestMapping(value = "/{userId}/",
produces = { "application/json" }, 
method = RequestMethod.PATCH)

public ResponseEntity<User> patchUser(
@PathVariable("userId") String userId,


@RequestBody HashMap userMap
)
  throws NotFoundException {

  return service.patchUser(userId,userMap);
 }

I get the following error : Error patch user feign.FeignException: status 415 reading UsersApi#patchUser(String,HashMap); The server refused this request because the request entity is in a format not supported by the requested resource for the requested method.

Any ideas?




Aucun commentaire:

Enregistrer un commentaire