Search code examples
apitwittersttwitterapi

Twitter API : /1.1/statuses/retweet/:id returns "Could not authenticate you”,”code”:32


I am using twitter api to get the retweets , for a particular tweets

 $url =    "https://api.twitter.com/1.1/statuses/retweet/830785820722343937.json";
 $requestMethod = 'POST';
  $getfield = "";

 $twitter = new TwitterAPIExchange($settings);
 $string = $twitter->setGetfield($getfield)
         ->buildOauth($url, $requestMethod)
         ->performRequest();
 $string = json_decode($string,$assoc = TRUE);

But getting this error

[code] => 32 [message] => Could not authenticate you.

Please help


Solution

  • Try after replacing the $url and $requestMethod as follows.

    $url = "https://api.twitter.com/1.1/statuses/retweets/830785820722343937.json";
    $requestMethod = 'GET';
    

    See https://dev.twitter.com/rest/reference/get/statuses/retweets/id for more.

    As I mentioned in comment, the $url and $requestMethod used in your code are not for getting retweets. You are using something else, see https://dev.twitter.com/rest/reference/post/statuses/retweet/id to leaarn about it and find the difference.