I referred to this generic post on Restful search/filtering. However I am trying to design it using Yii2. I want use the basic yii2 capabilities of searching through ModelSearch and make the result accessible as RESTFul endpoints. My objective is two fold which let me put forward as a use case and what I have built until now.
GET http://app.com/api/v1/cars returns the list of cars
GET api/v1/cars/1 returns the car at id 1
POST api/v1/car creates a new car
PUT api/v1/cars/1 modifies the car at id 1
The car table has various columns such as name, manufacturer, alternate_name. I would like user to search/filter against each of these columns. I can imagine of implementing it this way
GET api/v1/cars?name=Audi
GET api/v1/cars?technical_name=Quattro
Second scenario is of a global search wherein any input by user would match across all the columns at once. I thought of implementing it this way:
GET api/v1/cars?search=query
query="Le mans german manufacturer"
So, I have two questions. What are the pros and cons to this design? And how do I implement it using the default Yii2 rest implementation (yii\rest\ActiveController)?