a. /user/joined/organizations
和/user/created/organizations
b. /user/organizations?relation=joined/created
c. post
/organizations/:organization_id/users/:user_id/joined
和delete
/organizations/:organization_id/users/:user_id/joined
d. post
/organizations/:organization_id/memberships
和delete
/organizations/:organization_id/memberships/:user_id
a 和 b 哪个好些? c 和 d 哪个好些?
1
Kilerd 2015-10-29 21:11:22 +08:00
a c 更偏向于 restful 吧。其实如果系统是自己设计,自己用(就是团队内部),两个都没差
主要的是写好文档, = =! 格式统一一下就好,不要一个是这个风格,一个又是那种风格的。 BTW , 我个人的话更喜欢用 b 这一种。 |
2
msg7086 2015-10-29 21:31:24 +08:00
GET /my/orgs/joined
GET /my/orgs/created CREATE /orgs/:id/members/:username DELETE /orgs/:id/members/:username 我大概会设计成这样。 |