I have been trying to build a secured REST endpoint to save (and return) a person object. So far I have a method as below:
@RequestMapping(value = "/save/", method = RequestMethod.POST)
public Person save(@RequestBody Person person) {
return repository.save(person);
}
I have been trying to use Postman to test this endpoint, but don't seem to be able to structure the URL in the correct way. I should say that I have successfully tested find(Long id) (/find/{id}) and findall.
http://localhost:8080/api/save?person={"id":2,"first":"Brian","last":"Smith"}
First, is this the correct way to structure an endpoint for saving an object, and is the Postman structure correct?