【问题标题】:`409 Conflict` response: {"code":"MissingParameter","message":"You must provide a user key."}`409 Conflict` 响应:{"code":"MissingParameter","message":"您必须提供用户密钥。"}
【发布时间】:2019-01-19 03:21:27
【问题描述】:

所以我搞乱了 Marvel API,我一直收到这个错误,我在任何地方都找不到它的任何痕迹。

`409 Conflict` response: {"code":"MissingParameter","message":"You must provide a user key."} 

我查看了 API 文档,但找不到任何关于用户密钥的信息。

这是我的代码;我正在使用 Laravel 和 Guzzle。

$res = $client->request('GET', 'http://gateway.marvel.com:80/v1/public/comics', [
        'apikey' => $apikey,
        'ts' => $now,
        'hash' => md5($now . $privateKey . $apikey),

    ]);

任何帮助将不胜感激。

【问题讨论】:

    标签: laravel rest api


    【解决方案1】:

    尝试使用http_build_query

    $query = http_build_query([
         'apikey' => $apikey, 
         'ts' => $now, 
         'hash' => md5($now . $privateKey . $apikey)
    ]);
    
    $url = 'http://gateway.marvel.com:80/v1/public/comics?' . $query;
    
    $res = $client->request('GET', $url);
    

    更新

    看来您只需要在请求中设置query 选项即可。

    $res = $client->request('GET', 'http://gateway.marvel.com:80/v1/public/comics', [
        'query' => [
            'apikey' => $apikey, 
            'ts' => $now, 
            'hash' => md5($now . $privateKey . $apikey)
        ]
    ]);
    

    【讨论】:

    • 你是明星。非常感谢。这对它进行了排序。
    【解决方案2】:

    更改上传文件夹,问题解决。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-02-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-10-11
      • 2014-08-31
      • 1970-01-01
      相关资源
      最近更新 更多