I have a basic CRUD endpoint, and I want to be able to search by arbitrary fields in my database. Is there a way to allow this without specifying every possible filter in the method signature?
Asked
Active
Viewed 139 times
3 Answers
0
I would just use query parameters to solve this. So just accept the fields like example.com/api/people/?name=John&age=20

Jeroen Noten
- 3,574
- 1
- 17
- 25
-
1Thanks, but I was looking to support arbitrary query parameters. Restler requires me to specify every possible query parameter in the method signature. On tables with 20+ columns, this isn't really feasable or necessary. – Jesse Weigert Oct 06 '15 at 18:39
0
If you don't need to document them, you can use $request_data as a parameter, this will get all the data that is sent to the API

Arul Kumaran
- 983
- 7
- 23
-
This works for POST requests, but I didn't have any luck with GET parameters. I ended up just reading from the $_GET[] structure. – Jesse Weigert Oct 07 '15 at 20:25