I am using npm package request https://www.npmjs.com/package/request to call Twitter API as follows:
request({ url: `https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=${screenName}&${countQuery}&tweet_mode=extended`,
method: "GET",
headers: {
"Authorization": auth
},
json: true
}, function (error, response, tweets) {
if (response.statusCode == 200) {
console.log(tweets)
}
}
})
The problem I am having is that in the returned tweets
object, the id of the tweet that is for example as follows:
"created_at": "Wed May 15 19:14:49 +0000 2019",
"id": 1128740534372184064,
"id_str": "1128740534372184064",
rounds to 1128740534372184000.
When I call the Twitter API with Postman, I see the correct (above) results, but looking at body of request
I see the rounded integer number. How can I fix this?
Could this be a Javascript issue? Use id_str
instead. https://developer.twitter.com/en/docs/basics/twitter-ids.html