Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Trouble setting up REST in 1,1RC1
  • Hey all, I'm having some difficulty setting up a rest controller with 1.1 RC1. Here's the stripped down case I'm working with: <code>
    class Controller_Api extends Controller_Rest { public function get_list () { $this->response(array("cheese"=>"burger")); }
    }
    </code> When I hit /api/list.json?cheese=burger (typing it into the browser so I know it's a GET) I get a 404. I have many other standard and template controllers humming along nicely in this app so I'm confident that it's not a larger config issue. What am I missing? Another big thanks to the Fuelphp Team. Keep on rocking the 5.3 :P Thanks in advance,
    David
  • My apologies for the messy code... not sure how to make those tags work in this forum. Anyway, concerning REST: Do I have to turn on a config somewhere? I'm not seeing anything other than straight controller implementation in the docs. Thanks!
  • Do you require defining the .json part of the url perhaps? Does your code work if you don't include that?
  • I was doing some tests my self on this and found that you can't use ?blah=testing in the url. Try doing api/list/burger
  • I've also just realised that your always going to get a 404 cause your passing parameters, cheese=burger yet your function doesn't have any parameters.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion