【问题标题】:FedEx Api: Bad Request Error, Missing or duplicate parameters. Please modify your request and try againFedEx Api:错误的请求错误,缺少或重复的参数。请修改您的请求,然后重试
【发布时间】:2021-01-04 15:09:08
【问题描述】:

由于某种原因,我在向 FedEx 发送 API 的身份验证时收到 400 Bad Request 错误。

这是我的代码:

  $payload = [
            'grant_type' => 'client_credentials',
            'client_id' => self::$apiKey,
            'client_secret' => self::$apiSecret
  ];

  $api = new App_ApiTransaction('POST', self::$authEndpoint, $payload, App_ApiTransaction::ENCODE_JSON);

  $api->addHeader( 'Content-Type', 'application/x-www-form-urlencoded');

我尝试使用 GET,但收到 405 错误。另外,这是一个自定义的标头函数。

什么可能导致问题? 谢谢, 凯文

【问题讨论】:

    标签: php rest restful-authentication fedex


    【解决方案1】:

    找到解决方案,这是我必须做的:

     $payload = ('grant_type=client_credentials&client_id='.self::$apiKey.'&client_secret='.self::$apiSecret);
    

    基本上把Payload改成了正确的格式

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-06-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多