I have referenced stackexchange's RESTful APIs.
From this, I have one situation that makes me confused.
I have this API:
/users/{user_id}/followings
On this API,
GET
means get the all follwing user lists of user_id
. This is good.
But, when I want to add one follwing user(this is kind of adding following user like instagram or facebook), should I have to use above REST API with PUT
?
I'm confused using PUT
with above API. Because, as above API means all follwing lists of user_id
, if I use this API to PUT
, it means put
the all follwing users to user_id
, not one following users.
Is it just OK to use above API to add(using put
method) one following user to user_id
?
You can just POST
a new user to /users/{user_id}/followings
. I wouldn't PUT
on a list - you can use a PATCH add
if you want to go down that path - see this link .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.