GET statuses/mentions_timeline original id not associated with replies

api

#1

I am having a hard time understanding the structure of the API call when using https://api.twitter.com/1.1/statuses/mentions_timeline.json.

According to their documentation in_reply_to_status_id_str is refered to as

If the represented Tweet is a reply, this field will contain the string representation of the original Tweet’s ID

That part I understand is so you can know what reply is associated with what original tweet. Makes sense…

Now in the original tweet it will contain its ID in id_str

Problem is that when viewing the array even though I have tweets and replies the replies in_reply_to_status_id_str have an ID associated with them but that ID never matches the original tweets ID.

Here is an example output I am receiving. Excuse me if the array is huge but it’s what it is.

Array
(
[0] => stdClass Object
    (
        [created_at] => Wed Jul 25 23:25:31 +0000 2018
        [id] => 1022261593520857088
        [id_str] => 1022261593520857088
        [text] => @somecompany test https://example.com/0D83Rp32ZA
        [truncated] => 
        [extended_entities] => stdClass Object
            (
                [media] => Array
                    (
                        [0] => stdClass Object
                            (
                                [id] => 1022261588324016128
                                [id_str] => 1022261588324016128
                                [indices] => Array
                                    (
                                        [0] => 19
                                        [1] => 42
                                    )

                                [media_url] => http://pbs.twimg.com/media/Di_Nf5eUYAA58XD.jpg
                                [media_url_https] => https://pbs.twimg.com/media/Di_Nf5eUYAA58XD.jpg
                                [url] => https://example.com/0D83Rp32ZA
                                [display_url] => pic.twitter.com/0D83Rp32ZA
                                [expanded_url] => https://twitter.com/jsmith/status/1022261593520857088/photo/1
                                [type] => photo
                                [sizes] => stdClass Object
                                    (
                                        [thumb] => stdClass Object
                                            (
                                                [w] => 150
                                                [h] => 150
                                                [resize] => crop
                                            )

                                        [small] => stdClass Object
                                            (
                                                [w] => 640
                                                [h] => 480
                                                [resize] => fit
                                            )

                                        [large] => stdClass Object
                                            (
                                                [w] => 640
                                                [h] => 480
                                                [resize] => fit
                                            )

                                        [medium] => stdClass Object
                                            (
                                                [w] => 640
                                                [h] => 480
                                                [resize] => fit
                                            )

                                    )

                            )

                    )

            )

        [source] => <a href="http://twitter.com" rel="nofollow">Twitter Web Client</a>
        [in_reply_to_status_id] => 
        [in_reply_to_status_id_str] => 
        [in_reply_to_user_id] => 874407123177713664
        [in_reply_to_user_id_str] => 874407123177713664
        [in_reply_to_screen_name] => somecompany
        [user] => stdClass Object
            (
                [id] => 55914522
                [id_str] => 55914522
                [name] => John Smith
                [screen_name] => jsmith
                [location] => Las Vegas, NV
                [description] => Coder, Sys Admin, Star Wars Lover and #SEO FTW
                [url] => https://example.com/X76OkU3gFw
                [entities] => stdClass Object
                    (
                        [url] => stdClass Object
                            (
                                [urls] => Array
                                    (
                                        [0] => stdClass Object
                                            (
                                                [url] => https://example.com/X76OkU3gFw
                                                [expanded_url] => http://www.somecompany.com
                                                [display_url] => somecompany.com
                                                [indices] => Array
                                                    (
                                                        [0] => 0
                                                        [1] => 23
                                                    )

                                            )

                                    )

                            )

                        [description] => stdClass Object
                            (
                                [urls] => Array
                                    (
                                    )

                            )

                    )

                [protected] => 
                [followers_count] => 172
                [friends_count] => 59
                [listed_count] => 2
                [created_at] => Sat Jul 11 19:55:42 +0000 2009
                [favourites_count] => 59
                [utc_offset] => 
                [time_zone] => 
                [geo_enabled] => 1
                [verified] => 
                [statuses_count] => 675
                [lang] => en
                [contributors_enabled] => 
                [is_translator] => 
                [is_translation_enabled] => 
                [profile_background_color] => 131516
                [profile_background_image_url] => http://abs.twimg.com/images/themes/theme14/bg.gif
                [profile_background_image_url_https] => https://abs.twimg.com/images/themes/theme14/bg.gif
                [profile_background_tile] => 1
                [profile_image_url] => http://pbs.twimg.com/profile_images/423584132547891200/HxV6vRel_normal.jpeg
                [profile_image_url_https] => https://pbs.twimg.com/profile_images/423584132547891200/HxV6vRel_normal.jpeg
                [profile_banner_url] => https://pbs.twimg.com/profile_banners/55914522/1497644070
                [profile_link_color] => 009999
                [profile_sidebar_border_color] => EEEEEE
                [profile_sidebar_fill_color] => EFEFEF
                [profile_text_color] => 333333
                [profile_use_background_image] => 1
                [has_extended_profile] => 
                [default_profile] => 
                [default_profile_image] => 
                [following] => 
                [follow_request_sent] => 
                [notifications] => 
                [translator_type] => none
            )

        [geo] => 
        [coordinates] => 
        [place] => 
        [contributors] => 
        [is_quote_status] => 
        [retweet_count] => 0
        [favorite_count] => 1
        [favorited] => 
        [retweeted] => 
        [possibly_sensitive] => 
        [lang] => en
    )

[1] => stdClass Object
    (
        [created_at] => Wed Jul 25 23:50:13 +0000 2018
        [id] => 1022267810850852864
        [id_str] => 1022267810850852864
        [text] => @somecompany Back To you
        [truncated] => 
        [source] => <a href="http://twitter.com" rel="nofollow">Twitter Web Client</a>
        [in_reply_to_status_id] => 1022266741638934529
        [in_reply_to_status_id_str] => 1022266741638934529
        [in_reply_to_user_id] => 874407123177713664
        [in_reply_to_user_id_str] => 874407123177713664
        [in_reply_to_screen_name] => somecompany
        [user] => stdClass Object
            (
                [id] => 55914522
                [id_str] => 55914522
                [name] => John Smith
                [screen_name] => jsmith
                [location] => Las Vegas, NV
                [description] => Coder, Sys Admin, Star Wars Lover and #SEO FTW
                [url] => https://example.com/X76OkU3gFw
                [entities] => stdClass Object
                    (
                        [url] => stdClass Object
                            (
                                [urls] => Array
                                    (
                                        [0] => stdClass Object
                                            (
                                                [url] => https://example.com/X76OkU3gFw
                                                [expanded_url] => http://www.somecompany.com
                                                [display_url] => somecompany.com
                                                [indices] => Array
                                                    (
                                                        [0] => 0
                                                        [1] => 23
                                                    )

                                            )

                                    )

                            )

                        [description] => stdClass Object
                            (
                                [urls] => Array
                                    (
                                    )

                            )

                    )

                [protected] => 
                [followers_count] => 172
                [friends_count] => 59
                [listed_count] => 2
                [created_at] => Sat Jul 11 19:55:42 +0000 2009
                [favourites_count] => 59
                [utc_offset] => 
                [time_zone] => 
                [geo_enabled] => 1
                [verified] => 
                [statuses_count] => 675
                [lang] => en
                [contributors_enabled] => 
                [is_translator] => 
                [is_translation_enabled] => 
                [profile_background_color] => 131516
                [profile_background_image_url] => http://abs.twimg.com/images/themes/theme14/bg.gif
                [profile_background_image_url_https] => https://abs.twimg.com/images/themes/theme14/bg.gif
                [profile_background_tile] => 1
                [profile_image_url] => http://pbs.twimg.com/profile_images/423584132547891200/HxV6vRel_normal.jpeg
                [profile_image_url_https] => https://pbs.twimg.com/profile_images/423584132547891200/HxV6vRel_normal.jpeg
                [profile_banner_url] => https://pbs.twimg.com/profile_banners/55914522/1497644070
                [profile_link_color] => 009999
                [profile_sidebar_border_color] => EEEEEE
                [profile_sidebar_fill_color] => EFEFEF
                [profile_text_color] => 333333
                [profile_use_background_image] => 1
                [has_extended_profile] => 
                [default_profile] => 
                [default_profile_image] => 
                [following] => 
                [follow_request_sent] => 
                [notifications] => 
                [translator_type] => none
            )

        [geo] => 
        [coordinates] => 
        [place] => 
        [contributors] => 
        [is_quote_status] => 
        [retweet_count] => 0
        [favorite_count] => 0
        [favorited] => 
        [retweeted] => 
        [lang] => en
    )

[2] => stdClass Object
    (
        [created_at] => Thu Jul 26 18:13:20 +0000 2018
        [id] => 1022545418192740352
        [id_str] => 1022545418192740352
        [text] => @somecompany @jsmith I like
        [truncated] => 
        [source] => <a href="http://twitter.com/download/iphone" rel="nofollow">Twitter for iPhone</a>
        [in_reply_to_status_id] => 1022266300872048641
        [in_reply_to_status_id_str] => 1022266300872048641
        [in_reply_to_user_id] => 874407123177713664
        [in_reply_to_user_id_str] => 874407123177713664
        [in_reply_to_screen_name] => somecompany
        [user] => stdClass Object
            (
                [id] => 508050392
                [id_str] => 508050392
                [name] => Josh
                [screen_name] => jcarp53
                [location] => nunya, bidness
                [description] => 
                [url] => 
                [entities] => stdClass Object
                    (
                        [description] => stdClass Object
                            (
                                [urls] => Array
                                    (
                                    )

                            )

                    )

                [protected] => 
                [followers_count] => 48
                [friends_count] => 183
                [listed_count] => 0
                [created_at] => Tue Feb 28 23:03:17 +0000 2012
                [favourites_count] => 359
                [utc_offset] => 
                [time_zone] => 
                [geo_enabled] => 
                [verified] => 
                [statuses_count] => 798
                [lang] => en
                [contributors_enabled] => 
                [is_translator] => 
                [is_translation_enabled] => 
                [profile_background_color] => C0DEED
                [profile_background_image_url] => http://abs.twimg.com/images/themes/theme1/bg.png
                [profile_background_image_url_https] => https://abs.twimg.com/images/themes/theme1/bg.png
                [profile_background_tile] => 
                [profile_image_url] => http://pbs.twimg.com/profile_images/3598324323/914b87cec022095e4bbde9cc4ee902fc_normal.jpeg
                [profile_image_url_https] => https://pbs.twimg.com/profile_images/3598324323/914b87cec022095e4bbde9cc4ee902fc_normal.jpeg
                [profile_banner_url] => https://pbs.twimg.com/profile_banners/508050392/1367383299
                [profile_link_color] => 1DA1F2
                [profile_sidebar_border_color] => C0DEED
                [profile_sidebar_fill_color] => DDEEF6
                [profile_text_color] => 333333
                [profile_use_background_image] => 1
                [has_extended_profile] => 
                [default_profile] => 1
                [default_profile_image] => 
                [following] => 
                [follow_request_sent] => 
                [notifications] => 
                [translator_type] => none
            )

        [geo] => 
        [coordinates] => 
        [place] => 
        [contributors] => 
        [is_quote_status] => 
        [retweet_count] => 0
        [favorite_count] => 0
        [favorited] => 
        [retweeted] => 
        [lang] => en
    )

[3] => stdClass Object
    (
        [created_at] => Thu Jul 26 19:39:06 +0000 2018
        [id] => 1022567004270551040
        [id_str] => 1022567004270551040
        [text] => @somecompany Another test
        [truncated] => 
        [source] => <a href="http://twitter.com" rel="nofollow">Twitter Web Client</a>
        [in_reply_to_status_id] => 
        [in_reply_to_status_id_str] => 
        [in_reply_to_user_id] => 874407123177713664
        [in_reply_to_user_id_str] => 874407123177713664
        [in_reply_to_screen_name] => somecompany
        [user] => stdClass Object
            (
                [id] => 55914522
                [id_str] => 55914522
                [name] => John Smith
                [screen_name] => jsmith
                [location] => Las Vegas, NV
                [description] => Coder, Sys Admin, Star Wars Lover and #SEO FTW
                [url] => https://example.com/X76OkU3gFw
                [entities] => stdClass Object
                    (
                        [url] => stdClass Object
                            (
                                [urls] => Array
                                    (
                                        [0] => stdClass Object
                                            (
                                                [url] => https://example.com/X76OkU3gFw
                                                [expanded_url] => http://www.somecompany.com
                                                [display_url] => somecompany.com
                                                [indices] => Array
                                                    (
                                                        [0] => 0
                                                        [1] => 23
                                                    )

                                            )

                                    )

                            )

                        [description] => stdClass Object
                            (
                                [urls] => Array
                                    (
                                    )

                            )

                    )

                [protected] => 
                [followers_count] => 172
                [friends_count] => 59
                [listed_count] => 2
                [created_at] => Sat Jul 11 19:55:42 +0000 2009
                [favourites_count] => 59
                [utc_offset] => 
                [time_zone] => 
                [geo_enabled] => 1
                [verified] => 
                [statuses_count] => 675
                [lang] => en
                [contributors_enabled] => 
                [is_translator] => 
                [is_translation_enabled] => 
                [profile_background_color] => 131516
                [profile_background_image_url] => http://abs.twimg.com/images/themes/theme14/bg.gif
                [profile_background_image_url_https] => https://abs.twimg.com/images/themes/theme14/bg.gif
                [profile_background_tile] => 1
                [profile_image_url] => http://pbs.twimg.com/profile_images/423584132547891200/HxV6vRel_normal.jpeg
                [profile_image_url_https] => https://pbs.twimg.com/profile_images/423584132547891200/HxV6vRel_normal.jpeg
                [profile_banner_url] => https://pbs.twimg.com/profile_banners/55914522/1497644070
                [profile_link_color] => 009999
                [profile_sidebar_border_color] => EEEEEE
                [profile_sidebar_fill_color] => EFEFEF
                [profile_text_color] => 333333
                [profile_use_background_image] => 1
                [has_extended_profile] => 
                [default_profile] => 
                [default_profile_image] => 
                [following] => 
                [follow_request_sent] => 
                [notifications] => 
                [translator_type] => none
            )

        [geo] => 
        [coordinates] => 
        [place] => 
        [contributors] => 
        [is_quote_status] => 
        [retweet_count] => 0
        [favorite_count] => 0
        [favorited] => 
        [retweeted] => 
        [lang] => en
    )

)

There are 2 mentions in this array. The first original tweet has a id_str of 1022261593520857088. According to the documentation the following replies to that original tweet should contain that id in the in_reply_to_status_id_str. If you notice that original id is no where in any of the other in_reply_to_status_id_str including the replies to that tweet. So I am confused to the documentations description where it specifies that it should contain the id of the original tweet…which is doesn’t.

What I am trying to do is to be able to import the tweet and replies and associate them, but until I can find a common link between the original tweet and the associated replies I cannot do anything.

Also I should mention that I reversed the array so that the original tweet in on the top and the mentions follow below it


#2

Of the four tweets you include.

  1. 1022261593520857088 is the first and doesn’t reply to anything (as you mention).
  2. 1022267810850852864 does not exist and is a reply to a tweet that does not exist 1022266741638934529.
  3. 1022545418192740352 exists and replies to a tweet that 1022266300872048641.
  4. 1022567004270551040 exists but is not a reply to anything.

From those examples I can’t point to anything being wrong other than there are likely deleted tweets.

Looking at other tweets you have though shows 1022907239101816832 which is a reply to 1022898010299064320 which is a reply to 1022567004270551040 and is behaving as I would expect.

If you have specific status_ids that are not deleted and don’t correctly mark the in_reply_to_status_id please post them here. Keep in mind though that if you have tweet A with a reply B and B has a reply C, that C will link to B, not A.


#3

Yeah I have learned more of the structure of the API calls. You are right there are deleted tweets in there. My ultimate goal in all this was to get a tweet and all replies to that tweet but that is proving to be a little more difficult than I thought.


#4

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.