We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Errors in codeigniter-restserver library

Development and Programming

mstdmstd's avatar
mstdmstd
19 posts
9 years ago
mstdmstd's avatar mstdmstd

Hello, I want to use restful in my ci 3.03 application: 1) I found this link. It has interface methods I need. 2) I downloaded codeigniter-restserver-master.zip file and copied Format.php and REST_Controller.php(@version 3.0.0) files into /application/libraries/REST directory 3) I created control application/controllers/api/Users.php :

<?php

require_once("application/libraries/REST/REST_Controller.php");
require_once("application/libraries/REST/Format.php");

class Users extends REST_Controller
{
    //protected $rest_format = 'json';

    function users_get()
    {
        //$users = $this->user_model->get_all();
        $filter_username= $this->get('filter_username');
        $filter_user_group= $this->get('filter_user_group');
        $filter_active= $this->get('filter_active');
        $sort= $this->get('sort');
        $sort_direction= $this->get('sort_direction');

        $users_list = $this->muser->getUsersList(false, '', $filter_username, $filter_user_group, $filter_active, $sort, $sort_direction, ''); // that is just ref tomy model
        echo '<pre>'.count($users_list).'::$users_lists::'.print_r($users_list,true).'</pre>

<p>’;</p>

<pre><code>    if($users_list)
    {
        $this->response($users, 200);
    }

    else
    {
        $this->response(NULL, 404);
    }
}</code></pre>

AND RUNNING URL http://local-ci3.com/api/users I got many errors:

A PHP Error was encountered
Severity: Notice
Message: Undefined property: Users::$format
Filename: REST/REST_Controller.php
Line Number: 734
Backtrace:
File: /mnt/diskD_Work/wwwroot/ci3/application/libraries/REST/REST_Controller.php
Line: 734
Function: _error_handler
File: /mnt/diskD_Work/wwwroot/ci3/application/libraries/REST/REST_Controller.php
Line: 649
Function: response
File: /mnt/diskD_Work/wwwroot/ci3/index.php
Line: 292
Function: require_once

A PHP Error was encountered
Severity: Notice
Message: Undefined property: Users::$format
Filename: REST/REST_Controller.php
Line Number: 752
Backtrace:
File: /mnt/diskD_Work/wwwroot/ci3/application/libraries/REST/REST_Controller.php
Line: 752
Function: _error_handler
File: /mnt/diskD_Work/wwwroot/ci3/application/libraries/REST/REST_Controller.php
Line: 649
Function: response
File: /mnt/diskD_Work/wwwroot/ci3/index.php
Line: 292
Function: require_once

Actually I wanted to get some workable library to help me with REST api creation. I think that is preferable way istead of making from zero. But is this library not workable or does it needs for some fixing? Sorry, what I missed is if this library only for ci 2?

Can you, please, to tell me advice some codeigniter 3 REST api workable library with similar interface like library above?

Thanks!

       
TJ Draper's avatar
TJ Draper
222 posts
9 years ago
TJ Draper's avatar TJ Draper

Hi mstdmstd,

Others here are welcome to help you out if they would like, but you’ll probably have much better luck in the CodeIgniter forums. This is the ExpressionEngine forums and while CodeIgniter came out of EE and there’s still al lot of recognizable CodeIgniter in EE, EllisLab decided to sell it and focus solely on EE. So CodeIgniter is no longer an EllisLab product.

Here are the new official CodeIgniter forums:

https://www.codeigniter.com/community

I hope you find the answers you need. Good luck!

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.