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

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?

Related

How can My App Tweet the Contents a User Submits?

Note: I am posting this because I don't even know what to Google search. I know we're all about thorough research before asking these questions. Any help would be appreciated.
Scenario: User writes a text post from my app and when they submit it, the content is added to a Parse.com class (I know how to do this) and simultaneously it is tweeted from a designated twitter account (that does not belong to the user) let's say #MyCoolAppThatTweets.
In other words, I don't want the user via my app to be permanently logged into #MyCoolAppThatTweets twitter account, but have one-time access to send a tweet from it.
Another way to phrase this question would be: How can my app log into a specific twitter account whose credentials I can "bake" into the app without compromising the security of that twitter account.
I am already aware that normally, users of an iOS app wouldn't automatically want their content being tweeted. For the project I'm making, this is not going to be a concern (it's a secret).
If you need more information or if I need to post this elsewhere, please let me know!
From your question I am not sure if you are familiar with "Twitter part" of Parse.com and Twitter REST API. If not please start by reading this https://www.parse.com/docs/ios/guide#users-twitter-users (or take a look on official Twitter way by using their plugin called Fabric: https://dev.twitter.com/)
Since you mentioned PFUser I will describe you how to achieve it by using Parse.com API.
First your user must be logged in to Twitter account.
I suppose that your user is already logged in into your app as a PFUser so best way to log him into some Twitter account is by linking Twitter account with existing PFUser - https://www.parse.com/docs/ios/guide#users-linking.
After that you can post tweets through user's Twitter account (if permission was granted). I recommend doing that using Parse.com Twitter API calls https://www.parse.com/docs/ios/guide#users-login-amp-signup. To create API requests you need official Twitter REST API which can be obtained here https://dev.twitter.com/docs/api.

IOS twitter feed tutorial

I am currently building an app where they require all their users to be able to view their feeds only.
I looked at a lot of tutorials online which talk about the new api v1.1 of twitter and now authentication is required at all times.
I see a lot of examples and even successfully followed several of them like
http://www.appcoda.com/ios-programming-101-integrate-twitter-and-facebook-sharing-in-ios-6/
I even saw a tutorial posted on the twitter dev page.Following all of these focused on a few key elements
Using ACAccount to retrieve the account settings of the current user
Using the SLRequest to encapsulate the HTTP request made to the twitter api
Retrieving the data in JSON format, parsing it and presenting it to the user
Well my question is, I do not want user specific feeds. It's like a company updates their twitter regularly, users using the app should get feeds regarding the company. So I was wondering if there was a way, the app provides some default or hard coded authentication information ?
Is there some sort of tutorial, library or anything out there to help me move in the correct direction ?
Thank You for your time and help.
Your going to want to implement the following API call to get that information:
https://dev.twitter.com/docs/api/1.1/get/statuses/user_timeline
Once your application is authorized you can make a call to,
https://dev.twitter.com/docs/api/1.1/get/statuses/MorleyGaelsGAA.json
That should give you the information you're looking for.

Can I get a list of users who have authorized my Twitter app?

I'm trying to get a list of users who have authorized my Twitter application. I've tried checking the API docs, but there seems to be no twitter application specific APIs that I can find. I'm trying to avoid having to store these twitter user names myself, since the user list would be the exact same as Twitter's authorized user list and even handle deauthorized users for me.
No, there's no way to obtain this information from the Twitter API. If you're interested in keeping track of the users who are using your application, you'll need to track it yourself.

How to download Facebook page posts

I am an iOS developer and I am writing an app which needs to take statuses from my Facebook page and and display them in my app.
Does the Facebook API support that?
If it does, can anyone give a link for some tutorials or explain how can I make this?
I know that API supports an RSS feed but i don't found how to feed my statuses.
If you're using a Facebook page, you can easily use the graph API to query for posts made by that page. For example, for Starbucks:
http://graph.facebook.com/Starbucks/posts
You can simply load this in your browser to see the format the data comes back in, and all that's needed to access this data is a simple HTTP request. You can replace Starbucks with your Page's ID or username to get your Page's posts. These come back in JSON, which should be fairly easy to handle on your end.
Yes, the Facebook Graph API allows you to access your profile and extract any information you'd like from it.

Twitter feed on corporate site

I have a corporate website that I want to pull in tweets to, but i'm getting a rate limit using the http feed. So, I want to use an authenticated method to get the tweets.
Do I really have to register an application to do this, even though it's not really an application and my users will never be entering or changing the twitter account info.
Also, my corporate site doesn't have a public address, and registering an application through twitter appears to require a public url. So how can I get around this? Do I have to create a "fake" application with a public url, just to generate my keys?
Thanks for any help on this.
If your site is behind a proxy server along with all your users, using Javascript/jQuery won't help. All the requests will still be coming from the same IP and will hit a rate limit, as you're doing now.
The other issue is that you don't need to register an app to request a feed. Apps are only needed for Oauth, and getting a feed doesn't need that.
The best way to deal with this is to get the feed with a server script, store it on the server, and then deliver the server copy to the web pages. If you request the feed less than 150 times per hour, you won't have a limit problem.
If you want more than a single feed, you can use the streaming API to get all the tweets for up to 400 keywords or from up to 5,000 users. This still doesn't need a registered app, since the streaming API still allows Basic Auth.
Just wanted to post this for future reference and in case anyone else has the same question. The solution to my problem, was to register an application on twitter. But since I'm just using a single user, you don't have to do the regular OAuth steps of generating a request for a key, getting the response etc. Every app you register in twitter get's its own "Access Token" that you can use to retrieve tweets etc. So, this is what I ended up doing to solve the problem I was having.
Additional details: My main concern was having to do the OAuth steps of requesting an access code etc... Since my application is only a single user implementaion (just pulling in our company related tweets from company held twitter accounts), it just seemed unneccesary to have to do all of that. But what I found was that when you register an app on twitter, you get a private access token for each app. You can view a little information about that here: https://dev.twitter.com/pages/oauth_single_token.
It sounds like you are pulling the feed down over http on the server? You could just limit the updates so you don't hit the rate limit.
I would recommend instead doing this on the client side. There are a lot of very easy to use embeddable java script twitter clients out there. The rate limiting problem would dissapear as the feed would be coming from the desktop and not the server (unless they just kept refreshing it).
The Twitter developer wiki lists a few.
JQuery plugin for Twitter
Tweet (another JQuery plugin)

Resources