由于某种原因,当我向 FedEx 发送 API 的身份验证时,收到 400 错误请求错误。
这是我的代码:
$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 错误。另外,这是一个自定义 header 函数。
什么可能导致这个问题? 谢谢你, 凯文
最佳答案
找到了解决方案,这是我必须做的:
$payload = ('grant_type=client_credentials&client_id='.self::$apiKey.'&client_secret='.self::$apiSecret);
基本上将有效负载更改为正确的格式
关于php - FedEx Api : Bad Request Error, 参数丢失或重复。请修改您的请求并重试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63942851/