CodeIgniter Forums
POST method in REST architecture returning a 404 - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: POST method in REST architecture returning a 404 (/showthread.php?tid=53302)



POST method in REST architecture returning a 404 - El Forum - 07-18-2012

[eluser]Unknown[/eluser]
Hi all,
I've been using CI for a while but this is the first time I'm implementing REST.

GET, PUT, etc are all fine and work great. However when I use POST in the same routing settings, i get a 404 error.

I'm using CI version 1.7.

Here's my routing:
$route['service/test/file'] = "some_controller/createFile";

Controller:
class some_controller extends rest_controller {
public function createFile()
{
//--do something here
}
}

Again, using GET or PUT method is fine. I can get it to return whatever I want and all works. But using POST, even with nothing in the createFile function, i get a 404.

Had a snoop around CI code, I notice that the problem is somewhere in the router.php file. It looks like either _set_routing() and/or _parse_routes() is called twice, the first time being the correct route "some_controller/createFile" and the second time is something weird like "in/index.php".

Any ideas?


POST method in REST architecture returning a 404 - El Forum - 07-19-2012

[eluser]Unknown[/eluser]
I also tried with another REST test application and it's returning the same result.