Search code examples
javaandroidjsonhttptwitter

Twitter JSON API in Android Development


I Started working on Android Development for a while now. According to the tutorials im following im trying to retireve JSON info from the Twitter API...

As it was instructed in the tutorial, this is the code to use:

"http://api.twitter.com/1/statuses/user_timeline.json?screen_name=write the username"

HOWEVER, i got a response saying that the API is no longer available and i should migrate to API v1.1.

Could anyone please help on what to do to replace the url i was instructed to use??

NOTE When i used the new url from API v1.1 : "https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=twitterapi&count=2"

i get the following:

"{"errors":[{"message":"Bad Authentication data","code":215}]}"


Solution

  • Old Twitter API did not require Authentication for retrieving user_timeline, but v1.1 requires authentication to retrieve data(https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline). According to Twitter API document user authentication is required for all the API v1.1 requests.

    You can read more about authentication here https://dev.twitter.com/docs/auth/oauth#v1-1