Closed ghost closed 6 years ago
Optional parameters have to wrap completely like in the example
Flight::route('/blog(/@year(/@month(/@day)))', function($year, $month, $day){
// This will match the following URLS:
// /blog/2012/12/10
// /blog/2012/12
// /blog/2012
// /blog
});
You can have them next to each other like (@year)/(@month)
. Also, when designing your api, it's better to keep query parameters in the query and not the url. The url should just represent the object. So /api/users?orderBy=name&sort=desc
instead of /api/users/orderBy/name/sort/desc
Hi, I am having issues with Optional Parameters. I may not be using them correctly so please let me know if there is another way i can accomplish this.
This works: /api/itil/filter/12/orderby/8/ascending/1/page/2 (without /results/@ResultsPerPage)
But this does not work: /api/itil/filter/12/page/12
Here is my route code: