2

Please check question POSTing a @OneToMany sub-resource association in Spring Data REST

Now the common sense says to me to create a new comment, I should be able to make a POST to for example http://localhost/posts/1/comments. And at the same time, I should also be able to retrieve all comments of a user via a search on http://localhost/comments/search/findByCommenter?commenter=XXX.

With spring, posting the way I mention is not supported. You need to PATCH. And as far as I know, thats only if you don't have a dedicated comment repository. So you can either PATCH a new comment to http://localhost/posts/1/comments if you don't have a comment repository, or you have to POST to http://localhost/comments if you want the searchability of comments by commenters. Whats the reason behind this?

Community
  • 1
  • 1
aycanadal
  • 1,106
  • 2
  • 15
  • 42

0 Answers0