I use twitter API to retrieve the user home timeline tweets. I use json response format. Recently the tweet id (in API it is just 'id') are retuned wrong. As an example
normally it should return like this: "id": 14057503720, (example is from twitter console) however at my request it is returned like this: "id": 1172601832
It is 1 digit less and it is totally different. I need the proper ID because I can't make use of the parameters like since_id or max_id.
There was a problem authenticating your request. This could be due to missing or incorrect authentication credentials. This may also be returned in other undefined circumstances. Check that you are using the correct authentication method and that your credentials are correct.
All Twitter APIs that return Tweets provide that data encoded using JavaScript Object Notation (JSON). JSON is based on key-value pairs, with named attributes and associated values. These attributes, and their state are used to describe objects. At Twitter we serve many objects as JSON, including Tweets and Users.
Today, Twitter IDs are unique 64-bit unsigned integers, which are based on time, instead of being sequential. The full ID is composed of a timestamp, a worker number, and a sequence number.
Both Historical PowerTrack and Full-Archive Search provide access to any publicly available Tweet, starting with the first Tweet from March 2006. Deciding which product better suits your use case can be key in getting the data you want when you need it.
Use id_str
instead of id
. It doesn't seem to be documented, but if you look at the raw source of the JSON you can see that id_str
for each tweet is the one that correctly corresponds to the ID of the tweet.
It is 1 digit less and it is totally different. I need the proper ID because I can't make use of the parameters like since_id or max_id.
It is not totally different; just different. If you write both IDs in hex, you'll receive
0x345E47BE8
0x45E47BE8
Tweet IDs are 64-bit and somewhere in parsing you lose the most significant 32-bit half of it. Use id_str
as other (also in the linked article) suggest.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With