Welcome Guest, Not a member yet? Register   Sign In
Philip Sturgeon REST Server / Rest Client working with API auth
#1

[eluser]Flyingbeaver[/eluser]
Hi Wink

I've been trying to work with the API auth and I can generate keys, but whatever I do I always get : Response Not authorized.

Has someone tried it and could share the method please ?

So far I've done this... (#fail)
Code:
<?php
class Test extends CI_Controller {

    function  __construct()  {
        parent::__construct();
        
        $this->load->library('rest', array(  
            'server' => 'http://my-server:8888/api/'
        ));  
        $this->rest->api_key('7bbb53bb5f1a2c0c57ab6c909b675a29');  
    }

    function test()  
    {  
      $users = $this->rest->get('users');  
       echo $this->rest->debug();
    }  
}


Thx for help.
#2

[eluser]Flyingbeaver[/eluser]
OK Wink

Here is how i do the job :

Code:
<?php
class Test extends CI_Controller {

    function  __construct()  {
        parent::__construct();
        
        $this->load->library('rest', array(  
            'server' => 'http://my-server:8888/api/'
        ));  
        
        $this->rest->api_key('7bbb53bb5f1a2c0c57ab6c909b675a29');
    }

    function test()  
    {  
      $key = $this->rest->put('users', '', 'json');  
      
      echo $this->rest->debug();
    }  
}

don't forget to enable api rest in rest config file and to remove auth from this file to.

If I'm doing it wrong plz let me know.

Thx phil for this amazing work Wink




Theme © iAndrew 2016 - Forum software by © MyBB