M
M
Mark2019-09-22 04:03:05
Yii
Mark, 2019-09-22 04:03:05

How to set path via GET parameter in Yii2 API?

It is necessary that the path to the action be formed due to the GET parameter.
Example:
There is a URL: domain.com/api/v1/order/create
The format must be: domain.com/api?action=add
In fact, it is solved using the URL manager, but the rule did not give the expected result:
'<action:add>' => 'v1/order/create'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitsliputsli, 2019-09-22
@Vitsliputsli

You want weird. If you don't like pretty url, don't use it, in its original form the controller/action is set as a parameter in the address. But why reinvent your own routing when using a framework?
And, usually, when they talk about rest, they mean one of the Richardson models, i.e. using http methods, in this case post or put.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question