API call failure

twitterkit

#1

so i am testing twitter api for my android mobile app .i am currently showing 26 timelines using searchtimelines method .but the moment i increase the number from 26 it shows error code : “API call failure.
com.twitter.sdk.android.core.TwitterApiException: 403 Forbidden” this
i wanted to know is there a way i can show more than 26 timelines


#2

Hey @rominv13,

Are you always only getting this when hitting the 26th timeline? Can you share the bundle id or package name of your app?

-Mike


#3

yes i am always hitting that after inserting 27th timeline

here is the code i am using for getting the timelines : "SearchTimeline searchTimeline = null;
searchTimeline = new SearchTimeline.Builder()
.query(“from:GosuGamers OR from:follow2GD”); "
i am able to insert 26 screennames like this and after that if i add any the error comes


#4

Error would indicate there was some issue signing the request. Can you send the actual failing request so we can reproduce? Also we recommend no more than “10 keywords and operators be used.”

Best practices

  • Ensure all parameters are properly URL encoded.
  • Limit your searches to 10 keywords and operators.
  • Queries can be limited due to complexity. If this happens the Search API will respond with the error: {“error”:“Sorry, your query is too complex. Please reduce complexity and try again.”}.
  • The Search API is not complete index of all Tweets, but instead an index of recent Tweets. At the moment that index includes between 6-9 days of Tweets.

See: https://dev.twitter.com/rest/public/search


#5

no i am not getting an error saying :":“Sorry, your query is too complex. Please reduce complexity and try again.”

but i am using more than 10 keywords and operators because i want to show around 100 timelines in my app

the full error i am getting is : “E/Twitter: API call failure.
com.twitter.sdk.android.core.TwitterApiException: 403 Forbidden
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:383)
at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:423)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
” this. also if i am not able use more than 10 operators is there any other way i can call 100 timelines into the app


#6

Can you share here or email support@fabric.io? Having the exact query will help us get you answers.


#7

here is my code :

SearchTimeline searchTimeline = null;
        searchTimeline = new SearchTimeline.Builder()
                .query("from:GosuGamers OR from:follow2GD OR from:MSSDota OR from:BTSGoDz OR from:PyrionFlax OR from:StatsManBruno OR from:EvilGeniuses OR from:ODPixel OR from:TCDota OR from:CDECgaming OR from:wykrhm OR from:BuLbaDotA OR from:EHOMECN OR from:NewbeeCN OR from:ViCi_Gaming OR from:LiquidJerAx OR from:LiquidMATUMBA OR from:TrixiDota OR from:PieLieDieDota OR from:w33haa OR from:Yawar_YS OR from:the_evany OR from:MoonMeanderated OR from:Cr1tdota OR from:OGDota2 OR from:PurgeGamers OR from:Fnggshka OR from:Mushi_Chai OR from:team_empire OR from:ixmike88 OR from:dota2reddit OR from:QOdota OR from:followEGM OR from:zai_2002 OR from:teamsecret OR from:SumaaaaiL ")
                .build();

as you can see i can call till 26th timeline i dont get any error which is “OGDota2” but after that if i add 1 more timeline i get a error mentioned above . is there any other way i can call the timelines because i need to call around 100 timelines in my app


#8

The search/tweets API has a query character limit you are exceeding.
https://dev.twitter.com/rest/reference/get/search/tweets

If you have a known list of members you should consider creating a list and displaying a list timeline.


#9

yes i have tried that too here is my code for that :

TwitterApiClient twitterApiClient = TwitterCore.getInstance().getApiClient();
        SearchService search = twitterApiClient.getSearchService();

        search.tweets("from:rominv13", null, null, null,null, 5, null, null, null, false, new Callback<Search>() {
            @Override
            public void success(Result<Search> result) {
                list = result.data.tweets;
                FixedTweetTimeline timeline = new FixedTweetTimeline.Builder()
                        .setTweets(list)
                        .build();

                TweetTimelineListAdapter adapter = new TweetTimelineListAdapter.Builder(MainActivity.this)
                        .setTimeline(timeline)
                        .build();

                setListAdapter(adapter);
            }


            @Override
            public void failure(TwitterException exception) {
                exception.printStackTrace();
                Log.i("Error", "Error: "+exception.getMessage());
                Log.i("Error", "Error: "+exception.getLocalizedMessage());
            }
        });

but it throws a 403 forbidden error


#10

any updates?


#11

The code you’ve provided above shows another search Timeline, not a List timeline as was suggested previous.