0
votes

I am a complete nob in Codeigniter so please ignore if m being stupid. I have played with pyro cms for a while and i would like to have an API which could return all the blogs in JSOn / XML format. I have created a controller in the path :- pyrocms-pyrocms-dc143bc/system/cms/controllers/api(Created this folder)/mobile.php Following is the code :-

  <?php defined('BASEPATH') OR exit('No direct script access allowed');
   /**
   * The admin class is basically the main controller for the backend.
     *
    * @author      PyroCMS Dev Team
    * @copyright   Copyright (c) 2012, PyroCMS LLC
    * @package      PyroCMS\Core\Controllers
      */
   class mobile extends REST_Controller
    {
function __contruct()
{   
        parent::__construct();
    }

function content_get()
{
    $this->load->database();
    $this->db->select('*');
    $this->db->from('default_blog');
    $query = $this->db->get(); 
    return $this->response($query->result_array(),200);
}

}

IF i dont use pyro cms and use codeigniter normal package + Phil sturgeon REST Client then i can access the above method by going to http://example.com/pyrocms-pyrocms-dc143bc/api/mobile/content.json but in pyro cms i am not able to access it this way.

Edit

I have renamed the content.php to mobile.php and placed it in pyrocms-pyrocms-dc143bc/system/cms/modules/blog/controllers I am now able to access this controller with following url :- http://example.com/pyrocms-pyrocms-dc143bc/blog/mobile/content

{ status: false, error: "Invalid API Key." }

1

1 Answers

2
votes

I achieved this by editing the config.php by setting the

 $config['encryption_key']= "to_some_dummy_key"