Mismatch between id and id_str field values


#1

When making a request for tweets that mention the account @HamCoHealthIN (https://twitter.com/intent/user?user_id=735537393613340672), there was a tweet that we expected to be returned that wasn’t. The tweet in particular (https://twitter.com/Dq_Manley/status/812452324891312128) mentions @HamCoHealtIN and is still visible, so we expected this tweet to be returned in the list of mentions.

When requesting the specific tweet through the Twitter API Debugger, we noticed that in the user_mentions section, the id and id_str fields for HamCoHealthIN are do not match:

"user_mentions": [
{
	"screen_name": "HamCoHealthIN",
	"name": "Hamilton Co. Health",
	"id": 735537393613340700,
	"id_str": "735537393613340672",
	"indices": [
		0,
		14
	]
},
{
	"screen_name": "Fishers_Police",
	"name": "Fishers_Police",
	"id": 301467503,
	"id_str": "301467503",
	"indices": [
		15,
		30
	]
},
{
	"screen_name": "HSESchools",
	"name": "HSE Schools",
	"id": 1561139262,
	"id_str": "1561139262",
	"indices": [
		31,
		42
	]
}
]

We believe that this might be the reason why the tweet does not appear in the mentions feed for HamCoHealthIN, as the user id 735537393613340700 does not point to @HamCoHealthIN, but in fact points to a non-existent user page.


#2

The reason that those two numbers do not match is that your coding environment is mangling the long integer (see our documentation on Twitter IDs).

As for why that Tweet is not showing up, it will depend on the context. What API endpoint are you using to retrieve the Tweets in question, a timeline or via Search?


#3

Hi Andy,

While I was seeing this issue in our coding environment (and had previously investigated the link you posted in hopes of correcting the issue), the content in my original post is from Twitter’s API console, not from my coding environment. This led me to believe that this was more than an issue with my coding environment, since I can reproduce the issue by making the request through the Twitter API Console (https://dev.twitter.com/rest/tools/console), and not just my coding environment.

As far as the endpoint being used, the specific call used in the API Console to pull up the specific tweet uses the statuses endpoint. The call being made is:

https://api.twitter.com/1.1/statuses/show/812452324891312128.json

I’m also using OAuth 1 to authorize the call within the API Console.


#4

The API console is a third-party tool provided by Apigee, so unfortunately we don’t have the ability to modify the behaviour - Javascript has a known issue with long integers.

I understand that you’re able to get the individual Tweet using that endpoint but I thought I’d understood that in your own code you were not seeing the Tweet in a context where you expected it to be returned - is that correct?


#5

Andy,

For my own code, I expected to see the tweet in question come back when making a request to the timeline endpoint for the user in question.


#6

Do you see any Tweets earlier than that one, i.e. there’s a “gap” where you would expect that Tweet to be?

I haven’t checked that timeline myself to know how many Tweets there are or how old they are, but there are both volume and time-based limits on what you’ll see in a timeline call.


#7

I’m able to see two tweets from before the tweet in question, and at the time the issue first came to light I was able to see two replies to this particular tweet that were deleted after the fact and so do not show up currently when making the request. So this one tweet which hasn’t been deleted appears to be the only tweet missing.


#8

That’s odd, but it could have been marked as sensitive or reported as spam by another user, so there are explanations for the gap.