404 Error with Restler for the entire URL

I am trying to create a plugin to create an API server for the Oxwall infrastructure. I am new to Restler, but an experienced developer for the Oxwall platform.

I get the following error while accessing the URL.

{
  "error": {
    "code": 404,
    "message": "Not Found"
  },
  "debug": {
    "source": "Routes.php:383 at route stage",
    "stages": {
      "success": [
        "get"
      ],
      "failure": [
        "route",
        "negotiate",
        "message"
      ]
    }
  }
}

Oxwall has its own routing and MVC methods. The following describes how I defined the route (cmd is just a dummy value to make Oxwall consider it valid for say / * routes)

OW::getRouter()->addRoute(new OW_Route('service', 'say/:cmd', "OXWALLAPI_CTRL_Api", 'index'));

So, when I try to access http://www.mysite.com/say/hello , it gets an error above 404.

api.php:

use Luracast\Restler\Restler;

class OXWALLAPI_CTRL_Api extends OW_ActionController {

  public function __construct() {
       parent::__construct();

       $r = new Restler();
       $r->addAPIClass('Say');
       $r->handle();
   }

   public function index() {

   }

}

Say.php:

class Say {

    function hello($to = 'world') {
       return "Hello $to!";
    }

    function hi($to) {
       return "Hi $to!";
    }

}

Oxwall has its own .htaccess file. I placed below .htaccess in the plugin folder.

Options -MultiViews
DirectoryIndex index.php
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^$ index.php [QSA,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
<IfModule mod_php5.c>
php_flag display_errors Off
</IfModule>
+3
source share
1 answer
  • Is Say.phpin the same folder index.php?

Say.php, , , Say.php Test/Say.php Say.php

<?php
namespace Test;
use stdClass;
//..... the rest of your class

index.php

$r->addClass('Test\Say');
  • behat.yml?

base_url index.php

0

All Articles