get Twitter friends/followers' ids and nicknames - twitter

I am integrating Twitter into my mobile app. I am trying to get the friends or follower's ids and nicknames. One solution that I can find out is, using "friends/ids" to get the friends/followers ids, then "user/show" to get the user info.
However, "user/show" returns extended information of the user, if a user has a lot of friends/follower (say 1000), it will be very slow to get nick name of the user.
I wonder if there is any API that only returns ids and nicknames of friends or followers. Or there is other lightweight approach to resolve this issue.

There is no Twitter API call that just returns the screen names. You can use /friends/ids to get the user ids of 5,000 friends with each API call, and then use users/lookup to get the account info on 100 of these at a time. But you are limited to only 350 API calls per hour.
If you are building an app that is based on knowing all of the friends or followers of your users, you need to plan the way you present that. You cannot do what Twitter does, and expect to let someone login and then instantly display all their friends and followers. One way to deal with this is to ask for 24 hours to assemble their complete social network. The other technique is store every user's full profile into a database, so you don't have to look them up again.

Related

Twitter API How to know if a user is following another user?

I made a follow/following button so I need to know if the user A is already following the user B.
I know I can get all his/her friends with GET friends/ids but I'd like to know if there is a shorter way (without looping on the whole list, with cursors, etc.).
(Additional info: I'm using the iOS SDK)
Twitter API has a dedicated endpoint for this situation: friendships/show
The answer will give you all the information about the relationship between these two users, you just need to specify their screenname or user_id.

Is it possible to cross reference FB taggable_friends and local user records under API v2?

I am using Koala in a Rails app to get a user's friends for a simple tagging interface.
Some time back, Facebook changed the API (v2.0) such that this end point now returns a hashed ID, rather than the friend's FB ID. I've just started working with this endpoint for the first time since the change and am wondering, is it still possible to correlate an FB taggable_friends with a user of my app.
For example, within my app a user creates an event she attended, and now wants to tag friends she was with. The taggable_friends API allows taggings to be pushed to FB, but how do I also represent that tagging within my app?
The taggable_friends endpoint returns basic details such as name and avatar, so I could just store and display those. But if the friend is also a user of my app, and perhaps has a different avatar here, I'd like to display the details they have set in the app rather than FB details.
Is there any way to cross reference taggable_friends with local user records under the new API?
The tagging token is not valid forever, so you cannot cross-reference users. It would only be possible by name, but that is not reliable since users can change their name or two users can have the exact same one.
In other words: No, it is not possible.

Knowing if an account had tweeted

Background info:
My website has an account system and we wanted to give the accounts "reward points" everytime they tweeted / facebook share.
For facebook share, we are able to track which account had shared by using the redirect_uri and redirect them back to our site (with the specified url) and noting it. https://developers.facebook.com/docs/reference/dialogs/feed/
Is there such thing on twitter as well? I had been trying to find real hard but i can't find a way for me to inform my system that a certain account had tweeted.
Thanks!
One of the basic objects in the Twitter API is the User object, which gives you a decent amount of information about the user in question. Once of the properties of the User object is called "status", which is a Tweet object, which is the user's most recent tweet.
So, in your application, you could store the unique identifier and date/time of the user's last tweet. Then at an interval of your choosing, you could get the information about the user and see if the ID of their most recent tweet matches what you have in your database. If it does not match, then the user has posted a new tweet.
Twitter API documentation of the User object
Twitter API documenation of the Tweet object

Twitter API - Getting friends and follower ids for a set of users?

I am able to extract tweets, and the submitter's user details using the streaming API, but I also need the list of followers and friends of users posting these tweets.
I am aware that Twitter search API has the friends/ids and followers/ids functions through which one can get the public followers and friends list one user at a time.
But, my data collection requires getting this information for all the users whose tweets I have collected, around 20,000+ users. This is quite exhaustive given the high number of users, and the limitation of one user per call. Moreover, I need to refresh this list for each of these 20,000+ users preferably once a day to observe changes in their friends and followers (if any).
IS there any I can achieve this using the Twitter Streaming API or any other method. Or I have to apply for the Twitter commercial data license?
Thanks!!!
20,000 is way beyond the limits of any normal Twitter API method. I think your going to have to apply for a commercial license to go that high. The streaming API, I believe, tracks 400 keywords and 5000 users max. Your right in that the REST twitter API method only allows you to track one user or a list of ID's. You can take a look at the Twitter Counter API which mines additional info including information about followers, etc. But again, 20,000 I'm sure would be above the limits. Communicate with Twitter, Gnip and, and the Twitter Counter service to see what they can do for you.
Twitter Counter API:
http://twittercounter.com/pages/api?ref=footer

Using oAuth to retrieve tweets of a particular ID (equivalent to a page in facebook)

I need to know as to how to implement oAuth in an iphone application.
I have already gone through lot many posts but none of them shows as to How to retrieve tweets from a user profile (like we access facebook wallposts). I tried using an example named bengottlieb/Twitter-OAuth-iPhone but all it does is show the Login prompt and posts a sample Twit at my Twitter profile.
I need to make an application where
the user can view twits for a particular page (same as accessing the wall post for a Page)
Post tweets that will appear on his profile or if possible then also at the profile page for given ID
I was able to fetch the tweets for a particular id using http://search.twitter.com/search.json?ID but may be due to closing of Basic authentication it does not return to me tweets older than a specific time period.
The Twitter search API is not meant to retrieve the tweets from one particular user, even though it does seem to work (up to a certain point back in time). As far as I know the search API does not need authentication, so you're not in trouble regarding the deprecation of Basic authentication there.
To retrieve the tweets for a user, you need to retrieve their timeline. Be sure to use OAuth authentication, as indeed Basic authentication no longer works now.
Check out http://dev.twitter.com/ for more information. The API is documented quite well. You mention basic authentication, so perhaps you could start with http://dev.twitter.com/pages/basic_to_oauth to get you going?

Resources