Hi everyone!
I’m new in Yii2 REST API and i have following scenario:
I have User model with UserController.
UserController has many actions with update actions like activate, deactivate, placeInBlackbox, updatePassword, and other actions which update record partially and manage relations of record.
I learned that it can be resolved by PATCH method setting operation ID like the following:
PATCH /users/123
[
{ "op": "activate", "path": "/activate"}
]
PATCH /users/123
[
{ "op": "deactivate", "path": "/deactivate"}
]
But i can’t understand how to explain to UserController which action should be called based on operation ID sent by PATCH method.
Of course, i can do it making like:
PUT /users/123/do/activate or PUT /users/123/do/deactivate
but it’ not according to basic REST API Best practices: Use nouns but no verbs