2

I am new to the Twitter API and I'm having an issue with the user_timeline API.

I am using the following REST query:

https://api.twitter.com/1/statuses/user_timeline.xml?screen_name=twitterapi&count=50

which is provides the user's timeline data, however it only gives the user's tweets; I want all tweets by and about the user (i.e. the user's tweets, and mentions of the user by the user's followers).

Thanks in advance!

ataulm
  • 15,195
  • 7
  • 50
  • 92

2 Answers2

3

You can access this by searching for the user's @ handle. This will return tweets which mention @user and also tweets by @user.

Twitter API - Search

--

I've no experience about formatting for JSON calls but the following should be enough:

https://api.twitter.com/1.1/search/tweets.json?q=%40ataulm

The %40 is for the @ symbol, and ataulm is the user name you wish to query. See the page linked for default values to the other parameters - this will, for example, only return 15 tweets per "page" (not sure what a page refers to), but can be set to a maximum of 100 per page, using the count parameter.

ataulm
  • 15,195
  • 7
  • 50
  • 92
  • can you create query please? – Chintoo Khaade May 28 '13 at 15:27
  • @ChintooKhaade I've added an example you can try. – ataulm May 28 '13 at 16:54
  • ah note, this will also (if it works at all) return tweets mentioning the user which are not from the user's followers. If you want a combination of the user's tweets, and mentions for that user by the user's followers, I think you'll need two separate queries, and you'll have to manually combine the results. – ataulm May 28 '13 at 17:21
  • I am trying to copy and paste provided by your link but it is also not work. This is give an error with message {"errors":[{"message":"Bad Authentication data","code":215}]} – Chintoo Khaade May 29 '13 at 07:21
  • There was an error in the REST call - with two question marks instead of 1. But apart from that I'm not sure as I've no experience with the Twitter API. The documentation does say that authentication is **required** for this API though, so have you authenticated? Note also, my example is using the 1.1 version of the API, rather than the v1 you're using. – ataulm May 29 '13 at 08:46
  • I also use with single question mark provided by your link but it still give me same error. If have any another way to solve that Problem so please provide me solution. – Chintoo Khaade May 29 '13 at 10:59
  • You can use Twitter API v1, rather than 1.1 but I think it's deprecated. I suspect that the reason you're getting the error is because you haven't authenticated yourself using OAuth. http://stackoverflow.com/questions/12684765/twitter-api-returns-error-215-bad-authentication-data – ataulm May 29 '13 at 23:46
  • I tried with the above URL in a browser and it gave error code 215. Interestingly, I am logged into my Twitter account through the same browser. Why does it give authentication error ? – R11G Jun 06 '14 at 11:32
  • @R11G you should create a new question, listing your situation. Make sure you put the error code and what it represents – ataulm Jun 06 '14 at 11:55
0
"https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=".$twitteruser.'&count=500'

BUt it is giving only 200 records.

Amitesh Kumar
  • 3,051
  • 1
  • 26
  • 42