Paging with tweetinivi

Dec 23, 2013 at 6:07 AM

I am using this API and its really awesome to work with it. I just need to know i want to apply paging functionality when i get my time line. how can i do this? can you please tell me. i have looked all the functions provided by the API but not able to find any suitable function for applying paging.
Dec 23, 2013 at 11:17 PM
Hi Haseebkhan,

Currently this feature is not implemented. The reason for that is the fact that the number of tweets provided by Twitter is limited to 3200.
Twitter do provide a certain type of paging by providing cursor queries, but I will have to think about a solution to provide paging within Tweetinvi.

I would be happy to have any suggestion on which criteria you'd like to use to page. Currently I can only think of CreationDate and TweetId but you might have any other idea.

Also would you please give me a more detailed description of what you are trying to do.
Are you trying to use paging to store a minimal amount of information? Or is the purpose only related with displaying a specific set of tweets within a page?

Kind Regards,
Jan 21, 2014 at 7:29 AM
Edited Jan 21, 2014 at 7:30 AM
Hello Linvi

first of all i apologize that i couldn't reply on time because i was busy.

Before discussing about paging with tweetinivi i am facing another problem while using this api.

I am getting my home time line but not able to get it. when ever i try to call the function GetHomeTimeLine i received an error called
The remote server returned an error: (403) Forbidden.

The only function which is working right now is GetFollowers and rest of the function are giving error which i mentioned above.

Can you please help me to solve this issue i am stuck on my project. i debug your code and the line which is giving me error is this.

response = httpWebRequest.GetResponse();

Hope you will reply soon.

Jan 21, 2014 at 9:35 AM

Here is the description of 403 error on Twitter.
The request is understood, but it has been refused or access is not allowed. An accompanying error message will explain why. This code is used when requests are being denied due to update limits.
It means that for a specific reason you are currently not allowed to perform this query. This can either be a limitation on your token or a limitation because you have performed the query too many times.

To check the remaining number of request please take example to GetRateLimit in Examplinvi.
 ITokenRateLimits tokenLimits = token.GetRateLimit();
Console.WriteLine("Remaning Requests for GetRate : {0}", tokenLimits.ApplicationRateLimitStatusLimit.Remaining);
If the error persists, please analyze the error message using the TwitterContext class, again examples are provided in Examplinvi but here is for your specific case:
var tokenUser = new TokenUser(token);
TwitterContext context = new TwitterContext();
var success = context.TryInvokeAction(() =>
    var tweets = tokenUser.GetHomeTimeline();

if (!success)
    if (context.LastActionTwitterException.StatusCode == -1)
        Console.WriteLine("You have a connection problem!");
        // This is the important description
Please read the description and you'll probably have a better understanding of what is going wrong.
Give me an update when you have checked both of these.

Jan 21, 2014 at 11:38 AM

my remaining request are 179

when i try above code its still giving me error which is

Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object.
at TweetinCore.Extensions.DictionaryExtension.GetPropAs[T](Dictionary`2 dicti
onary, String propName) in d:\tweetinivi\TweetinCore\Extensions\DictionaryExtens
ion.cs:line 49
at TweetinCore.Exception.TwitterException.GetErrorsInfo(WebException wex) in
d:\tweetinivi\TweetinCore\Exception\TwitterException.cs:line 65
at TweetinCore.Exception.TwitterException..ctor(WebException wex) in d:\tweet
inivi\TweetinCore\Exception\TwitterException.cs:line 98
at Tweetinvi.TwitterExceptionTracker.ActionFailed(Object action, WebException
wex) in d:\tweetinivi\Tools\TwitterExceptionTracker.cs:line 58
at Tweetinvi.TwitterContext.OperationFailed(Object action, Exception ex) in d
:\tweetinivi\Tools\TwitterContext.cs:line 127
at Tweetinvi.TwitterContext.TryInvokeAction(Action action) in d:\tweetinivi\T
ools\TwitterContext.cs:line 94
at Examplinvi.Program.Main() in d:\tweetinivi\Examplinvi\Program.cs:line 1685

i am also using the same token with another api its working fine but with your API its giving me error.

Jan 21, 2014 at 2:36 PM

I will review this error tonight.

To help me understand your issue, would you please try to access the GetHomeTimeline from Tweetinvi 0.9 that you can download from Source Code and select the project development?

You can then test the HomeTimeline by updating the NewSolutionExamples method to :
public void NewSolutionExamples()
    // Initializing a Token with Twitter Credentials contained in the App.config
    TwitterCredentials.TokenCredentials = new TokenCredentials(
Let me know if this worked or not.
Jan 22, 2014 at 4:49 PM
Finally I know what is going wrong!
The update of Twitter made the https query invalid.

You downloaded from the download button or nuget which does not have the latest changes for https queries.
I will update both this downloads tonight. In the meantime you can download the latest version from the Source Code tab -> download.

Sorry for this issue.
Marked as answer by linvi on 1/24/2014 at 7:20 AM
Jan 24, 2014 at 4:27 AM
Hello Linvi

Thanks for solving the issue.