Fetch all email from Gmail account - ios

I can get the Information of user data and email address from google api with help from this link.
But my task is to get all user mails from a Gmail account, and display them in a table view.
I checked the Gmail API but can't get enough reference.
Is there any way to do it ?

You probably want to look into threads. While normally a programmer would probably think of background processes when talking about threads, Google refers to "groups" of messages as threads (how it groups an email and replies into a single message in the client). While the API Reference for threads has an example in Java, it shouldn't be too hard to translate it into Obj-C if you're already set up to make other calls to the Google API.
Specifically, look into the list method (linked above). Alternatively, you could use messages.list but they will be much less organized. Also know that I'm pretty sure you'll need to increase the maxResults as I believe the default max is 100.

Related

Add a larger number of block users via one Twitter Api request

I just learn about Twitter for couple of days. I 'm facing a problems in building an app that add a large number of users to block list via Twitter Api (POST blocks/list ). But this Api is only work with one user per request, using it will lead to 'API RATE LIMIT'. That I want here is a method that can add a lot of users to the block list via one request Can anyone help me overcome this problem ? Thank and best regards. Like this site http://blocktogether.org/
You're getting two things confused.
There is GET blocks/list which allows you to receive a list of a blocked users.
On the other hand POST blocks/create allows you to block users from your twitter account. I believe that's the one you're wanting.
Either way they're both rate limited and you'll need to send multiple requests to the twitter API in order to reach whatever number you're looking into adding. As of now, until twitter decides to change it, it's only 1 user at a time.

How to surpass rate limiting in Twitter?

I am trying to extract data from Twitter. The data includes the tweets and people who retweeted a particular tweet. I have 46,000 tweets and I need to find retweeters for each of the tweet. Further, using Twitter call: retweet/id, you can pass only one id at a time, limiting 15 requests per 15 minutes.
Is there any way to surpass this limit and make unlimited calls?
Not through the REST API, no.
You may want to investigate Twitter's Streaming API to see if the functionality it provides meets your needs. Accessing it is a little more complex than the REST API, but it may be able to help you meet your needs.
You will find people who will tell you to do things like set up dummy accounts and dummy applications. Don't do this. Twitter actively monitors the API for use patterns like this and you will find your applications and IP addresses blacklisted.

How does the "Sneak peak" Twitter account work?

So I came across this Twitter account while I was wasting time on Failblog. I became very intrigued by it. The way it works is this person tweets 'I think you mean "sneak peek"' whenever someone tweets something with the string "sneak peak" in it. And it is automated as I discovered by tweeting "Sneak peak" myself, and getting a response within seconds:
So my question is, how is this done?
Can you get notifications somehow when someone tweets something containing a certain string? Consider that this already happens when someone tweets your username, so it is technically possible.
Or does this person have a computer running all the time that searches twitter every few seconds for the string?
Or are both possible?
This almost certainly uses the Twitter Streaming API.
The set of streaming APIs offered by Twitter give developers low latency access to Twitter's global stream of Tweet data. A proper implementation of a streaming client will be pushed messages indicating Tweets and other events have occurred, without any of the overhead associated with polling a REST endpoint.
So, there is a server somewhere which is continually streaming the Twitter API, filtered for the specific term.
Whenever the server sees a new tweet come through the stream, it tweets the response automatically.
So, to answer your questions:
1) Yes.
2) Yes, but it's not constantly polling, it's receiving the data automatically.
Not sure about 1), but 2) is easily manageable using the search API :
http://search.twitter.com/search.atom?q=sneak%20peak will get you the recent tweets containing 'sneak peak'. (including the time of the tweet)
Then the program can answer to those people, and keeping the time of the tweet in order to not tweet to people which the program has already tweeted to.

How to get a list of all retweeters in Twitter?

I have seen numerous companies doing like Twitter lotteries where users got to retweet their tweet and then one of retweeters will get the prize or whatever.
I was wondering now how do they get the list of all retweeters or pick the winner?
I checked Twitter API and found only this thing: GET statuses/retweets/:id but it returns maximum of 100 retweeters. Is that the only way?
It looks likes there's a couple services out there doing almost exactly this. A quick google pulls up http://onekontest.com/ and there's a few other Twitter contest services, but they all seem to be different levels of broken since they haven't kept up with changes to the API.
As far as the Twitter API itself is concerned, if you were expecting more than 100 responses, I think using GET statuses/mentions makes the most sense. That API call returns any mentions of a user, and you can pass the flag include_rts to include any retweets of your tweets. Then, if you wanted to list RTs of a specific tweet, you could check the in_reply_to_status_id field in the returned data to see if it matches the original tweet ID. This API call only returns the last 800 status, 200 at a time, so if you expect a bunch of data, you would need to poll the API repeatedly over time to get all the tweets. I imagine services like favstar are doing exactly this, just on a larger scale.
If you're actually looking for code to do something like this, I wrote a sinatra app called twitter-rss-digest which handles querying Twitter over time to track different sorts of queries. It's pretty rough, and doesn't quite handle this specifically, but it might point you in the right direction if you want to code something.
The Twitter API has an endpoint that returns up to 100 retweeter IDs for a given tweet.
Note that for historical reasons, that endpoint only returns up to 100 results and the documentation about the cursor is useless. Twitter refused to fix the situation.
2013 note
That said, the first thread on the Developers site that surfaced in a quick google has #episod, a Twitter employee saying:
You can't likely get to all of them. The data is spread out. Your best bet is to use the REST API to determine many of the users who performed the retweet, but the data will still be constrained.
It's easiest to track retweets as they happen rather than try to find them from the past. Use the Streaming API for that.
I like muffinista's method, but I think if you want a 100% complete list of retweets, simply enable the retweet email notifications and write a script that polls the email box for those matching the subject "retweeted one of your Tweets!" and put the data into a table. Do this right from the start.
The site https://twren.ch/ enlists all the retweeters for a given tweet (note that it only enlists retweeters who are direct followers of the source tweeter.) Nevertheless its probably the only public source available.

Get follower count on Twitter API search results

What I'm trying to do is pull some search results, and sort them by users.
Right now I'm using
$to->OAuthRequest('http://search.twitter.com/search.json', array('q' => 'search-term'), 'GET');
to get the results, but I can't actually get information about the user like follower_count, etc. so I though I'd take each result's user_id, and run it through http://twitter.com/users/show.xml to get the rest of the information.
The problem is, if I get 50 results that way, that's 50 API calls, which is 1/3 of the hourly limit...
Is there a better way to do this?
Update:
I have requested whitelisting, and the guys at Twitter told me I should instead use the new Streaming API.
This kinda sucks since it's in Alpha testing, and the documentation is unclear, but the concept looks cool, and the limits are different than the regular API. Gonna dive into it later.
Only reliable user information you can get from twitter search results are username (from_user) and profile image url. If you want more information, you will have to call the users/show method for each user. There is no workaround or better way(that I'm aware of).
You will have to Cache user information and request whitelisting.

Resources