I have 4 Apis that I expose, and I don't know what method should I use for them (POST/PUT/DELETE).
The DB object (let's call it User) contains
{"id", "foreignId1", "foreignId2"}
I have 4 methods -
assignForegin1
unassignForegin1
assignForegin2
unassignForegin2
In each one, I'm getting only 2 parameters - 1 id and 1 foreignId (after that I'm creating a User with the relevant fields out of it). Assign - if there is no id, I'm creating a new one with this foreignId, and if it exists, I override/assigning the new foreginId. Unassign - I'm removing the foreginId from this id, and if the id contains no foreginIds, I delete it.
So, assign is half PUT and half POST, and the unassign is half PUT and half DELETE.
What will be the best practice in this scenario?
Thanks