Hello,
i have a REST api , i am using a urlFormat:
array(’/Api<controller>/index’, ‘pattern’ => ‘https://<api:(api|api-test)>.website.com/<version:(v1)>/<controller:\w+>/’, ‘verb’ => ‘GET’),
array(’/Api<controller>/index’, ‘pattern’ => ‘https://<api:(api|api-test)>.website.com/<version:(v1)>/<controller:\w+>/<id:\w+>’, ‘verb’ => ‘GET’),
…
array(’/Api<controller>/create’, ‘pattern’ => ‘https://<api:(api|api-test)>.website.com/<version:(v1)>/<controller:\w+>/’, ‘verb’ => ‘POST’),
array(’/Api<controller>/remove’, ‘pattern’ => ‘https://<api:(api|api-test)>.website.com/<version:(v1)>/<controller:\w+>/<id:\w+>’, ‘verb’ => ‘DELETE’),
array(’/Api<controller>/update’, ‘pattern’ => ‘https://<api:(api|api-test)>.website.com/<version:(v1)>/<controller:\w+>/<id:\w+>’, ‘verb’ => ‘PUT’),
…
I want to be able to give my clients a REST from this sort:
[POST] to /v1/object1/8767/object2 - create object2 by object1
and these sort of stuff.
array(’/Api<controller>/index’, ‘pattern’ => ‘https://<api:(api|api-test)>.website.com/<version:(v1)>/<controller:\w+>/<id:\w+>/<action:\w+>’, ‘verb’ => ‘GET’),
array(’/Api<controller>/index’, ‘pattern’ => ‘https://<api:(api|api-test)>.website.com/<version:(v1)>/<controller:\w+>/<id:\w+>/<action:\w+>/<action_id:\w+>’, ‘verb’ => ‘GET’),
ther than creating a very special index function that receives action and action_id as parameters and call another internal function.
is there a way to do this in a smarter way ?