调用Instagram Basic Display API遇「不支持请求方法类型」错误求助
问题:Instagram Basic Display API 持续返回「Unsupported request - method type」错误
我正在使用Instagram Basic Display API,近几日一直收到「Unsupported request - method type」错误。我的应用已上线并通过Meta验证多年,此前运行正常。
无论是生产环境的代码,还是用Postman通过有效令牌发起的原生cURL请求,都会返回相同的错误。
获取长生命周期用户访问令牌的代码示例
$params = [ 'endpoint_url' => 'https://graph.instagram.com/access_token', 'type' => 'GET', 'url_params' => [ 'grant_type' => 'ig_exchange_token', 'client_secret' => $this->_appSecret, 'access_token' => $this->_userAccessToken ] ]; $ch = curl_init(); $endpoint = $params['endpoint_url']; if ('POST' == $params['type']) { // post curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($params['url_params'])); curl_setopt($ch, CURLOPT_POST, 1); } elseif ('GET' == $params['type'] && !$params['url_params']['paging']) { // get $params['url_params']['access_token'] = $this->_userAccessToken; // add params to endpoint $endpoint .= '?' . http_build_query($params['url_params']); } curl_setopt($ch, CURLOPT_URL, $endpoint); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $response = curl_exec($ch); curl_close($ch); $responseArray = json_decode($response, true); if (isset($responseArray['error_type'])) { var_dump($responseArray); die(); } else { return $responseArray; }
测试用的简单cURL请求
curl -X GET https://graph.instagram.com/me?fields=id,username&access_token={VALID_TOKEN}
返回的错误信息
{ "error": { "message": "Unsupported request - method type: get", "type": "IGApiException", "code": 100, "fbtrace_id": "A32uEK5vFtH166PBEaDxkAO" } }
内容的提问来源于stack exchange,提问作者David
相关产品推荐
相关产品推荐

