Can't use native retweet: not getting correct tweet id through API


We’re trying to use twitter’s native retweet on our site. The documentation at says to get the tweet ID from the API, but the ID returned doesn’t work - I get a message saying that the tweet doesn’t exist.

When I inspect the statuses object in the user_timeline.json xhr on twitter, I can see that each tweet has both an id and an id_str. The id is the one we’re getting back through the api, but when I grabbed the id_str and pasted it into my retweet url, it did the retweet correctly. We haven’t been able to find the id_str through the API (We’re using twitter4j). The id and the id_str are slightly different.

Is the id being returned through the API correct? Are these values meant to be the same? If not, is there a way to get access to the id_str?



In some environments, the act of parsing and looking at the ID value munges it, due to its gigantic size. See [node:194] for more info. Use id_str to be safe. The ids are the same when they leave our servers – if you see them different, it means that the act of observing the ID has changed it.