What is the correct way to format a REST URL that sets object relationships? -
i reading rest web service tutorial here:
www.drdobbs.com/web-development/restful-web-services-a-tutorial/240169069?pgno=3
it in, example "club" has "person"s members.
the suggested url format reading , updating person is:
http://myservice/persons/{personid}
the suggested url format reading , updating club is:
http://myservice/clubs/{clubid}
my question is, appropriate restful url format doing things making person member of club, or removing person club?
for example, i'm imagining ...
http://myservice/addmembertoclub?clubid=1&personid=2
... doesn't seem conform restful standard format.
those responsibilities club not person. means person should have nothing resource trying update, being club, not person, person should not change nature adding club (even though might have foreign key club).
so best approach
/myservice/clubs/{clubid}/person/{personid}
this same url delete method should delete person club , put method should add new person club.
Comments
Post a Comment