Question

I'm damned if I can make this work. Your help would be appreciated. I have valid access tokens, and can use twitteroauth to post status updates. However: every way I've tried to come at retweets has failed.

$parameters = array('id' => $status_id);
$retweet = $connection->post('statuses/retweet', $parameters);

Gets an error response of "not found." I'm not sure what's not found - the id of the tweet that I'm trying to retweet, or the method I'm calling (statuses/retweet). I'm passing valid ID's through the request (I can find them on Twitter), and so on. Any ideas?

Here's the documentation: http://dev.twitter.com/doc/post/statuses/retweet/:id

I've also tried:

$parameters = array('id' => $status_id);
$retweet = $connection->post('statuses/retweet/', $parameters);

$parameters = array('id' => $status_id);
$retweet = $connection->post('statuses/retweet/:', $parameters);

and...

$retweet = $connection->post('statuses/retweet/:123456.json');

With either null responses (??) or the same enigmatic "not found."

Was it helpful?

Solution

$retweet = $connection->post('statuses/retweet/123456');

:id is a variable syntax that similar to PHP's $id so you replace it in its entirety with the value.

$parameters is only used when the key value pairs are getting added as URL parameters like ?key=value not in the URL path.

The format is automatically handled by the library so you should not include .json manually.

OTHER TIPS

Another tip on this issue is to reference "id_str" rather than the "id" as the "id" integer is sometimes wrong.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top