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

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.

Related

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.

New venue from within ios app?

(EDITED for clarification)
In a nutshell we're trying to allow users to create Foursquare venues in our app but we're having problems.
Detailed problem description:
We're developing an iOS app where our users can create events.
Users register and login with Facebook.
When a user wants to select location for their event they do a text search using Foursquare's API. (Just like when you add a location to your Instagram photo for
example if you're familiar with this).
If the venue exists the user will see it in the list and select it and all is fine.
If however the venue doesn't already exist in Foursquare we've found no way to add it. Compare to Instagram where you
get the option of adding the location directly in-app through
Foursquare's API if the search turns up empty.
Thanks user rckoenes for the API link. We're interpreting the API as it is OK to list venues with "userless access" but in order to make a POST the API "Requires Acting User".
Somehow Instagram seems to manage to allow this without forcing the user to authenticate to Foursquare but we don't see how and we want to avoid having to have this authentication in the app settings(asking them to do this with Facebook is asking enough).
Foursquare API link: https://developer.foursquare.com/overview/auth
I hope this clears things up.
Original post:
If our user can't find the right venue in our app (location search powered by foursquare) how can they create it?
This is possible within Instagram but we haven't found how to replicate it.
Is it possible?
We're developing for iOS.
Thankful for any helpful comments :)
Great question. To answer "how to add venues?", rckoenes was indeed correct when he suggested the venues/add endpoint, but you're right to note that this isn't possible unless there's an actively logged in user.
Just to clarify though, Instagram does not add venues to Foursquare when they allow their users to "Create a custom location." When an Instagram user does this, a "text tag" is associated with their photo and this never gets added to Foursquare, nor is it even searchable on Instagram again (the user would have to re-create it every time they want to use this location). Instagram's UI subtly differentiates this by coloring Foursquare venues as blue and allowing users to see more details on the venue while graying out non-Foursquare venues. The reason that these text tags aren't able to be searched again is that doing so would effectively create your own independent location database, which is a violation of our usage policies.
You can consider Instagram's approach if it's appropriate for your situation, but of course the best solution is to allow your users to authenticate through Foursquare, saving their access tokens, and make venue/add requests on behalf of users themselves. This has recently gotten much easier since the release of Foursquare native auth for iOS.

Is it possible for a Facebook page to access the ID's of every user who 'likes' that page using Facebook Connect for iOS?

I am making an app in Xcode which has users register via Facebook, their ID number is then stored in our database along with their device token so that we can send them push messages.
In order to have companies use the app, we would like them to be able to send messages to all registered users who also like their Facebook page. Obviously this means accessing a potentially huge list of IDs, but tbh I'm not sure this is even possible.
Presumably it's not done in the same way as accessing a profiles friends list as they are not friends (would they be fans? likes?). I can access a users friends list easily enough, but I would be appreciative if someone could point me in the right direction as to whether the same thing is possible for business pages.
Thank you.
Facebook doesn't allow access to userId's unless they specifically allow an app permission. This can be done via asking for any permission and a userId will be given.
In your other case you get around this because a user gives permission to access their friends list.

get Twitter friends/followers' ids and nicknames

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.

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