Moving child resource to another parent in REST -
i have rest service.
and need have functionality move child resources 1 parent another, example move book 1 author another.
my variant is:
post /api/books/x/moveto/y but how create such architect restful way?
from rest point of view, urls should used locate resources rather expressing operations. express operations, existing http verbs should used.
looks "move" operation replacing author of book.
and put method seems way go:
the
putmethod requests state of target resource created or replaced state defined representation enclosed in request message payload. [...]
so, can have endpoint following:
put /api/books/{bookid}/author and request payload contain representation of new author.
Comments
Post a Comment