Tweet.GetTweet returns null

Mar 13, 2014 at 4:35 PM
Passing in a valid Tweet.Id into GetTweet(), for example
                    var tweet = Tweet.GetTweet (theTweetId);
always returns null and the following exception is lodged:

TwitterDescription "Not Found - The URI requested is invalid or the resource requested, such as a user, does not exists. Also returned when the requested format is not supported by the requested method."

I have even trapped a Tweet sent by another user in UserStream/BackgroundWorkerOnDoWork routine and passed its Tweet.Id straight into this method and it still returns null

Are there any common causes of this ?

Thanks
Coordinator
Mar 13, 2014 at 6:33 PM
Hi,

Are you sure that you have the right to access this Tweet?
You could have received Not Found if it was deleted after it got published or if it was private and you are not allowed to view it.

Linvi
Mar 14, 2014 at 9:36 AM
Edited Mar 14, 2014 at 5:25 PM
The tweet had not been deleted as I had sent it from another user in a web browser.
Although the user was not anyone I was following or followed by, I was mentioned in it and I have R/W & Direct Messages permissions.

I have reduced the code to access the tweet from its id as soon as it arrives in as MentionedUser tweet.

This adds a line to code you kindly provided earlier and demonstrates the problem for me at least.
        userStream.TweetCreatedByAnyone += (s, args) =>
        {
            var userMentions = args.Tweet.UserMentions;
            if (userMentions != null && userMentions.Any(x => x.ScreenName == m_OwnScreenName))
            {
                 if (backgroundWorker.CancellationPending)
                    userStream.StopStream();

                    backgroundWorker.ReportProgress(++nbTweetDetected, args.Tweet);
                    var tweet = Tweet.GetTweet(args.Tweet.Id);
                    var x=0;
                                                                                  }
        };
variable tweet always returns null
Am I missing something obvious here?
Mar 14, 2014 at 5:22 PM
Edited Mar 14, 2014 at 5:26 PM
Hi Linvi
are you able to reproduce this from the above code?
That is, when I breakpoint on var x=0; (to keep var tweet in scope) tweet is always null, even though the Id passed to GetTweet looks good.
Coordinator
Mar 14, 2014 at 7:16 PM
Hi,

Sorry for not responding before. I am not able to reproduce your issue. I have tried over 500 tweets none of them failed :(
Do you have a way to reproduce it at 100% so that I can get the issue?

Could you please let me know the user from who you receive the tweet?
In the meantime, please know that args.Tweet is in fact the tweet containing all the information.

Please keep up to date.
Linvi
Mar 18, 2014 at 10:21 AM
Edited Mar 18, 2014 at 10:22 AM
Please see this snippet of code which displays what I believe is unexpected behaviour :
            var newTweet = Tweet.CreateTweet("tweeting text");
            newTweet.Publish();
            // at this point newTweet.Id contained 445866829584822272
            var theTweet = Tweet.GetTweet(newTweet.Id);
            // here theTweet is null
            int forbreakpoint = 0;

So, given the Tweet.Id how would I recover the associated Tweet ?

Thanks.

(Using TweetinviAPI. 0.9.0.1)
Coordinator
Mar 18, 2014 at 10:26 AM
Hi,

Would you please use the latest version of Tweetinvi 0.9.0.4, I detected a bug that might cause this issue.
If you are using nuget just do a Update-Package TweetinviAPI

Linvi
Mar 18, 2014 at 10:51 AM
I have just tried this and can confirm this has resolved the problem.

Many thanks for your help and your library!