I'm trying to get all tweets for a particular #tag & it works if that #tag is trending on twitter,but if I use a custom #tag,which has only one or two tweets,its throwing errors(Object reference not set...)?
This is my code sample:
TwitterCredentials.SetCredentials("AccessToken", ".AccessSecret","ConsumerKey","ConsumerSecret");
var tokenRateLimits = RateLimit.GetCurrentCredentialsRateLimits();
if(okenRateLimits.ApplicationRateLimitStatusLimit.Remaining>0)
{
var searchParameter = Search.GenerateSearchTweetParameter("#MYCUSTOMHASHTAG");
var tweets = Search.SearchTweets(searchParameter);// getting error here
var count=tweets.Count;
}
I've tried with twitter api & it's returning the tweets:
https://api.twitter.com/1.1/search/tweets.json?q=%23MYCUSTOMHASHTAG;
-Regards,
Vikram
Comments: ** Comment from web user: vsrathore2 **
Hello Linvi,
I'm attaching new screen-shot as per your suggestion.
Response is 429 ,I did Google about this & it has something to do with Rate limiting.
I'm sure we are not calling API too beyond Rate limit.
This is how I'm calling the API:
```
TwitterCredentials.SetCredentials(objGlobal.AccessToken.Rendered, objGlobal.AccessSecret.Rendered, objGlobal.ConsumerKey.Rendered, objGlobal.ConsumerSecret.Rendered);
var tokenRateLimits = RateLimit.GetCurrentCredentialsRateLimits();
if (tokenRateLimits.ApplicationRateLimitStatusLimit.Remaining > 0)
{
var searchParameter = Search.GenerateSearchTweetParameter("#" + objGlobal.HashTag.Rendered);
searchParameter.MaximumNumberOfResults = 1000;
var tweets = Search.SearchTweets(searchParameter);// In this line it throws the error
}
```
-Vikram