Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
API url Structure
  • I'm working on creating our API using FuelPHP vs codeigniter however i do have a question regarding url structure. is there a way to have url's for get statements be something like this? /v1/controller/function/paramkey/paramval/paramkey/paramval rather than using ?key=value&key=value I would like to do this only for get and delete requests and it would be great if i didn't have to use routing. Lastly I found a bug with the rest.php file in config if I set the default_format it's not understood by the application I have to specify in the controller it self with protected $format = value Thanks
  • Like CI FuelPHP also uses URI segments by default, so the url's you want is standard behaviour. If you don't want any routing, I would suggest to make a module for every API version, so your 'v1' becomes the module name, and 'controller/function' would directly map to a module controller method. You could achieve the same thing with a sub-directory (app/classes/controller/v1/controllername), but I find that less clean. The Rest controller is made to work through ajax calls. If you call your API using your browser, the framework will not detect it as an ajax call, and will do some things differently. This is not a bug, this is by design.

Howdy, Stranger!

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

In this Discussion