We want to make our web service API more RESTful, so I'm trying my hand at routing variables. It seems simple, but I'm getting a 404 error...
It's a Laravel 3 project, and I'm trying to define a new route.
Right now, our URL's look like: api/object/v1/find?some=thing&another=thing
.
My goal is to have them look more like: API/v2/objects/{numericID}
.
Everything works fine when testing with this...
<?php
Route::get('v2/companies', function() {
return 'Hello';
});
This too...
Route::get('v2/companies/id', function( $id = 5678 ) {
return print_r($id, TRUE);;
});
But when I try:
Route::get('v2/companies/{id}', function( $id = 5678 )
{
return print_r($id, TRUE);
});
..it all goes to hell.
Calling a URL like \api\v2\companies\1234
throws a 404.
What gives??