Phil Sturgeon's REST server, Codeigniter3, error messages no return on PUT Phil Sturgeon's REST server, Codeigniter3, error messages no return on PUT codeigniter codeigniter

Phil Sturgeon's REST server, Codeigniter3, error messages no return on PUT


you must read this link,

http://code.tutsplus.com/tutorials/working-with-restful-services-in-codeigniter-2--net-8814

if you use apikey, you must set

    $config['rest_auth'] = 'basic'    $config['rest_enable_keys'] = TRUE;

also make a table in database for storing api key

CREATE TABLE `keys` (    `id` INT(11) NOT NULL AUTO_INCREMENT,    `user_id` INT(11) NOT NULL,    `key` VARCHAR(40) NOT NULL,    `level` INT(2) NOT NULL,    `ignore_limits` TINYINT(1) NOT NULL DEFAULT '0',    `is_private_key` TINYINT(1)  NOT NULL DEFAULT '0',    `ip_addresses` TEXT NULL DEFAULT NULL,    `date_created` INT(11) NOT NULL,    PRIMARY KEY (`id`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;

insert into that database minimum 1 row, the important column only key, it is the apikey

the apikey must contains 40 digits alphanumeric for security reasons

and again, you must read documentation, and the rest.php in application/config

    $config['rest_valid_logins'] = ['admin' => '1234'];

that login is set by default, so you must insert that login in your header of client request, etc

    http_user           'admin'    http_pass           '1234'    X-API-KEY           '123456'    first_name          test    email_address       abc

if that header not work, try this

    http_user           'admin'    http_pass           '1234'    api_name            'X-API-KEY'    api_key             '123456'    first_name          test    email_address       abc

if you have try request like this before with your

    $config['rest_auth'] = FALSE

actually you not yet securing your api webservice


I was placing the PUT variables in the Headers tab within POSTman.

Only the X-API-KEY belongs in the request header. The rest of the data (e.g. email_address, first_name, etc) should be passed in the request body (e.g. from within the Body tab of POSTman).

All works correctly now.