Clarification regarding gmail message apis - gmail-api

What is the Order in which the message list returns the messages. i.e message.list api? Whether it is based on the message timestamp or any other field.
If I want to sync a very large mailbox and I fire a message.list api, then I get a pageToken for pagination, so how long is the pageToken valid? For eg if I get a page token X and I fire the api to fetch the next page after 6-7 hours will I still get the expected response.
As this pageToken validity is not mentioned in the gmail api doc, any approach on how can full mail sync be done if the service which is syncing the mailbox restarts.

If I remember correctly the order of returned emails is "newest first, to older ones". I don't believe a pageToken would expire in 6-7 hours but why would you wait for so long to get the next page? If you care about getting new emails a few hours later then you want to use the history methods, starting with startHistoryId that you get from your full load.

Related

Fetch gmail thread conversation of my crm contacts only

Basically am using gmail php api to show gmail inbox for my users. But the main thing is that i only want to show the gmail thread conversations of my crm contacts. For this i pass all the emails of my contacts in the q parameter of gmails threads but this the q parameter works only untill 250 emails after that i got bad request error in response. could anyone please tell is there any limit on the length of q parameter of gmail php api or a better way to handle this situation..
Because of the query length limit, you will most likely have to divide your set of emails into batches that fit within the query limit.
If performance is an issue, you can use a batch request to group the email batches into a single request. See: https://developers.google.com/gmail/api/guides/batch
Note: the requests within your batch will still be subject to rate and concurrent request limits. See: https://developers.google.com/gmail/api/v1/reference/quota

Fetching "cancelled" events through the Office 365 REST API

I'm having trouble figuring out a way to fetch "cancelled" events on Office 365. It seems like a pretty basic thing to do, however none of my attempts at figuring out how to do so have worked.
Reading the Office 365 API documentation, I can see that the Event resource has an IsCancelled boolean attribute, which should show true if the event was cancelled/deleted.
I've tried the numerous methods of getting events through the API with no luck. It seems that once an event is cancelled, it simply is removed from the returned results.
I also see that I can use OData query parameters to try and filter the results of the event fetching response, so I even tried setting a $filter=IsCancelled eq true query parameter on the request, but all I got back was a response with an empty data array. :/
Is there something obvious I'm missing? The documentation's pretty light here.
Today, the calendar REST APIs match Outlook behavior. So https://outlook.office365.com/api/v1.0/Me/Events?$filter=isCancelled%20eq%20true only returns deleted events that appear on a user's Outlook as "Cancelled: " in the subject line. Once a user removes a cancelled meeting from their calendar, it won't be returned. For meeting series, we don't have a way to currently return only the instances that were deleted.
Returning deleted events (single meetings, series, and specific instances of a series) is on our roadmap, as multiple partners have requested it. However, I don't have a timeline to share with you at the moment.

Getting history events for just new messages?

I'd like to monitor a users gmail account for new messages and take an appropriate action. Is there a way to fetch the history events for just new messages but NOT for things like starring an email or changing its labels, etc.?
So I ended up using messages.list and storing the timestamp of the most recent message. Then on subsequent calls to messages.list I'd supply a query of "after:theMostRecentTimestampIKnowOf" to find new messages since the last time we synced.
Another route I've seen done, is if you have the ability to add a filter (e.g. user's can do that, or use the Google Admin SDK for Google Apps users, or do it through HTML/DOM hacking) then you can simply setup a filter to apply a label to all new messages. Then just messages.list(labelId=THAT_LABEL) when you do your polling (and remove it after you process them).
There is not any ability now to filter history based on change type, though it's something that would be nice to provide at some point.

How to implement Facebook Post Type objects in GAE?

I a new programmer and trying to implement a facebook type "feed" in my application. Like Whenever a user do some changes in his profile his linked profiles will get to know that in the form of news feed.
But I am stuck on that as I thought whenever any user saves any data (like "News", "Blog", "Event" or any "Comment") just send the id of the respective classes to the linked profiles and they will see it. Since the id is not generated before the object is saved , the problem is how can I send them. I thought of following workarounds but each have some problem.
Whenever a user posts a news .... a Post object will be made and added to User's Post Collection.
But How do the other users will knew about it.....
1) Send them the id .... but when the id is not created how can you send them the id.
2) Send them the post message and when ever they will click them ... the latest post to them from the particular user will be shown.. but if more than 3 messages then which will be shown?? Shown by the post creation Date no post greater than that date is shownn....but he needs to be shown newer posts..
3) Save the post in all followers feed. the data will be much larger then
4) all the followers on login will check all the persons they are following and save their feed after the time stamp? How to implement this as the Post is saved in User's Profile so I would have to check all the following person and then just check the feed and show them on his feed box; I think I would have to use batch Processes. Processing will take much longer.
I am using objectify-appengine to do operations on GAE.
Any help is appreciated
Are you wanting to update the page with posts in real time like on Facebook and Twitter? To achieve this on Google App Engine you can use the Channel API, which works in conjunction with Javascript to listen for new data and update the DOM.
This talk at Google I/O 2009 by Brett Slatkin describes exactly the pattern you should use for this.

Pulling facebook and twitter status updates into a SQL database via Coldfusion Page

I'd like to set up a coldfusion page that will pull the status updates from my own facebook account and twitter accounts and put them in a SQL database along with their timestamps. Whenever I run this page it should only grab information after the most recent time stamp it already has within the database.
I'm hoping this won't be too bad because all I'm interested in is just status updates and their time stamps. Eventually I'd like to pull other things like images and such, but for a first test just status updates is fine. Does anyone have sample code and/or pointers that could assist me in this endeavor?
I'd like it if any information relates to the current version of the apis (twitter with oAuth and facebook open graph) if they are necessary. Some solutions I've seen involve the creation of a twitter application and facebook application to interact with the APIs; is that necessary if all I want to do is access a subset of my own account information? Thanks in advance!
I would read the max(insertDate) from the database and if the API allows you, only request updates since that date. Then insert those updates. The next time you run you'll just need to get the max() of the last bunch of updates before calling for the next bunch.
You could run it every 5 minutes using a ColdFusion scheduled task.
How you communicate with the API is usually using <cfhttp />. One thing I always do is log every request and response, either in a text file, or in a database. That's can be invaluable when troubleshooting.
Hope that helps.
Use the cffeed tag to pull RSS feeds from Twitter and Facebook. Retain the date of the last feed scan somewhere (application variable or database) and loop over the feed entries. Any entry older than last scan is ignored, everything else gets committed. Make sure to wrap cffeed in a try/catch, as it will throw errors if the service is down (ahem, twitter) As mentioned in other answers, set it up as a scheduled task.
<cffeed action="read" properties="feedMetadata" query="feedQuery"
source="http://search.twitter.com/search.atom?q=+from:mytwitteraccount" />
Different approach than what you're suggesting, but it worked for us. We had two live events, where we asked people to post to a bespoke Facebook fan page, or to Twitter with a hashtag we endorsed for the event in realtime. Then we just fetched and parsed the RSS feeds of the FB page, and the Twitter search results, extracting what was new, on a short interval... I think it was approximately every three minutes. CFFEED was a little error-prone and wonky, just doing a CFHTTP get of the RSS feeds, and then processing the CFHTTP.filecontent struct item as XML worked fine
.LAG

Resources