Php 使用RestServer的Api密钥无效

Php 使用RestServer的Api密钥无效,php,codeigniter,codeigniter-restserver,Php,Codeigniter,Codeigniter Restserver,我正在使用 当我输入并按enter键时,会出现以下错误: <xml> <status>0</status> <error>Invalid API Key</error> </xml> 我也遇到了同样的问题。不要在URL中提到put/get/post,RestServer本身根据您传递的参数识别请求的性质,这是解决问题所需的两个步骤 第一步: 必须更改为: 第二步: 在keys表(config/rest.php文件中显示

我正在使用

当我输入并按enter键时,会出现以下错误:

<xml>
<status>0</status>
<error>Invalid API Key</error>
</xml>

我也遇到了同样的问题。不要在URL中提到put/get/post,RestServer本身根据您传递的参数识别请求的性质,这是解决问题所需的两个步骤

第一步:

必须更改为:

第二步:

在keys表(config/rest.php文件中显示的表结构)中使用
sha1
(最多40个字符)创建api kay, 在
is_private_key
字段中输入1,在
ip_address
字段中输入::1。
创建记录,然后再次检查。

这个问题很老了,但对于找到这个问题的人来说,答案是:

库使用PUT方法时,API键应作为x-www-form-urlencoded类型位于PUT头变量中

使用google chrome postman并像下图一样填充:

听起来您传递的API密钥无效!如果需要帮助,请发布index_put.php中的代码以及该代码可能包含的任何代码。您是否在数据库中创建并填充了
表是的,我用一个键填充了键表key@abdul它不起作用。错误“=>”无效的API密钥“,
public function index_put() {
        // Build a new key
        $key = self::_generate_key();
        // If no key level provided, give them a rubbish one
        $level = $this->put('level') ? $this->put('level') : 1;
        $ignore_limits = $this->put('ignore_limits') ? $this->put('ignore_limits') : 1;

        // Insert the new key
        if (self::_insert_key($key, array('level' => $level, 'ignore_limits' => $ignore_limits))) {
            $this->response(array('status' => 1, 'key' => $key), 201); // 201 = Created
        } else {
            $this->response(array('status' => 0, 'error' => 'Could not save the key.'), 500); // 500 = Internal Server Error
        }
    }