I've read the following topics/tutorials:
- Codeigniter RESTful API Server
- http://code.tutsplus.com/tutorials/working-with-restful-services-in-codeigniter--net-8814
- https://github.com/chriskacerguis/codeigniter-restserver
And I still can't figure out why I'm with route problems and XML problems.
My webservice controller is in the folder controllers/api/webservice.php
<?php defined('BASEPATH') OR exit('No direct script access allowed');
require APPPATH.'/libraries/RESTful/REST_Controller.php';
class webservice extends REST_Controller{
function get() {
$data = array();
$data['name'] = "TESTNAME";
$this->response($data);
}
}
In the tutorials there is no need to add routes, and in order to receive the XML page error I needed to add the following route or it wouldn't work:
$route['api/webservice/get'] = 'api/webservice/get';
My structure folder of codeIgniter:
> application
> config
rest.php (did not change anything from the GitHub download)
> controllers
> api
webservice.php
key.php
> libraries
> RESTful
REST_Controller.php (changed line 206 to: $this->load->library('RESTful/format');)
format.php
From the tutorial, the following link works without routes:
http://localhost/testRestful/index.php/api/example/users
Mine only works with route
http://localhost/myproject/index.php/api/webservice/get
And I receive the following error:
It does not say anything else. I can't figure out which file is the error talking about.