Google Calendar API get events in a specific language - calendar

I'm trying to get the brazilian holidays using Google Calendar through this URL:
https://www.googleapis.com/calendar/v3/calendars/en.brazilian%23holiday%40group.v.calendar.google.com/events?key=MyKey&timeMin=2017-01-01T09:11:13.562Z&timeMax=2017-12-31T09:11:13.562Z
This works fine, but I'm getting the holidays in English language, and I need to get it in Portuguese. There is some parameter which I can use to get JSON in another language? Or that is not possible?

You may want to add locale in your Events: list request while setting with an allowed value given in Google Calendar API - Settings. Note that locale refers to user's locale. So, if you do wish to get list of events in Portuguese, add locale with value pt_BR or pt_PT. If your HTTP request is done successfully, this will return events on the specified calendar.
For the complete list of the supported languages and their corresponding code, see Language Support documentation.

Related

Reviewing iCloud Calendars

Question: Is there a way to either confirm that an iCloud calendar is empty or, alternatively, to list the contents of the calendar?
Background: I have a number of calendars (iCloud, Google and others) that I have created over the years. I now want to manage them down to a smaller number and remove duplicate events and actions.
Currently I am looking at my iCloud calendars. A couple of the calendars appear to be empty because I cannot see anything from them on my calendar when I scroll back and forward through the months. However, it's possible that the calendar my contain something that I have forgotten but don't want to lose.
You can access iCloud calendars using the standard
CalDAV protocol. As a recent complication you need to setup an app-specific-password to access your account.
You fail to mention what programming environment you want to do this in, but:
Building a CalDAV client
is a great resource.
Basic stuff like listing calendars can also be done quite easily using tools like curl and xmlstarlet.

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.

Is it possible in google app engine (go) to format a date using the users local web browser timezone?

Is it possible in google app engine (go) to format a date using the users local web browser timezone?
Ultimately users should be able to pick/adjust their timezone, but for now the users computer timezone should be sufficient.
You would need to send that information along the http request and then make sure is one of appengine's recognized timezones and then format it with the time package
you can read more about the whole thing here:
http://www.goinggo.net/2013/08/using-time-timezones-and-location-in-go.html
Depending on your application, but an appengine http request header should include few variables, namely 'X-AppEngine-Country' which is the country from which the request originated, as an ISO 3166-1 alpha-2 country code, determined from the client's IP address.
You may then able to use this country code (i.e. AU, GB) to detect the sender timezone and format the UTC time to local.
http://golang.org/pkg/time/
For user selected timezone, you would need to pass an information in as you may know.

Code that can access all major online calendars?

I'm working on a service that needs to be able to read items from users' calendars. It needs to work whether the user is using Google Calendar, Exchange, Hotmail/Live, iCal, etc...
I want to do this (effectively):
calendar = Login(emailaddress, password); // Works for #hotmail.com, #gmail.com...
// For every item in the users' calendar extract the location of the meeting
for each (item in calendar)
location = item.Location;
I figure someone must have built some code that abstracts away the varied ways you login to these services and access the objects. But I haven't found anything yet. Any pointers would be appreciated. I don't really care what it's written in (Ruby, Python, C#, Java) as long as I can wrap it.
UPDATE: I've been able to get something working against the Google Calendar using the Google Calendar API. In the process I came across CalDAV and the fact that Google, Yahoo, and Apple support it. I'm going to focus on CalDAV for now, and then probably plumb in Hotmail/Live and Exchange later. I really only need the calendar event times and location so this should not be too challenging.
UPDATE 2: I have discovered DDay.iCal. I'd like to use this as my top level abstraction within my app. But I still have not found anything that will help me connect to, and interact with each of the popular mail systems. Nor have I found any code that shows how to layer DDay.ICal over CalDAV (which, theoretically, would give me Google, Yahoo, and Apple). Anyone?
There is a calendar REST API for Hotmail which is available in beta form as part of the developer preview of the Live SDK. This is also a beta interactive SDK for the REST API which you can try out at http://beta.isdk.dev.live.com. Just try out the query "/me/calendars"

How to I access reports programmatically in SalesForce using Apex

I'm trying to write an app on the SalesForce platform that can pull a list of contacts from a report and send them to a web service (say to send them an email or SMS)
The only way I can seem to find to do this is to add the report results to a newly created campaign, and then access that campaign. This seems like the long way around.
Every post I read online says you can't access the reports through Apex, however most or all of these posts were written before Version 20 of the API was released last month, which introduced a new report object. I can now programmatically access info about a report (Such as the date last run etc) but I still can't seem to find a way to access the result data contained in that report.
Does anyone know if there's a way to do that?
After much research into it, I've discovered the only way to do this at the moment is indeed to scrape the CSV document. I would guess that Conga etc are using exactly this method.
We've been doing this for a while now, and it works. The only caveats are:
Salesforce username / password /
security token has to be shared to
the app connecting. If the password
changes (and by default it is changed
every 30 days or so) the token also
changes and must be re-entered.
You have to know the host of the account, which can be difficult to
get right. For instance while most european accounts would use emea.salesforce.com to access CSV, our account uses na7 (North America 7) even though we're located in
ireland. I'm currently sending the page host to the app and parsing it
to calculate the correct subdomain to use, but I think there has to be a
better way to do this.
Salesforce really needs to sort this out by supplying an API call which allows custom report results to be exported on the fly and allowing us to use OAuth to connect to it. But of course, this is unlikely to happen.
In the SalesforceSpring 11 update, it seems you can obtain more informations about the Reports:
As stated in the API for Report and ReportType, you can access via Apex the fields used in the query by the Report, reading the field "columns", as well as the field used to represent the filters called "filter".
Iterating through this objects, should allow you to build a String representing the same query of the Report. After building that string you can make a dynamic query with a Database.query(..) call.
It seems to be a little messy, but should work.. (NOT TESTED YET!)
As header states, this works only with Custom Reports!
Just to clarify for fellow rookies who will find this, when the question was asked you could access your report data programatically, but you had to use some hacky, error prone methods.
This is all fixed, you can now access your reports via the API as of Winter '14.
Documentation here - http://www.salesforce.com/us/developer/docs/api_analytics/index.htm
Go to town on those custom dashboards etc. Cross posted from the Salesforce Stack Exchange - https://salesforce.stackexchange.com/questions/337/can-report-data-be-accessed-programatically/
But Conga (appextremes) do this in their QuickMerge product, where the user specifies the report Id, and the apex script on the page runs the report to extract the results for a mail merge operation.
the v20.0 API added metadata about the reports, but no way to actually run the report and obtain the results. If this is a standard report, or a report you've defined, you can work out the equivalent SOQL query for your report and run that, but if its an end user defined report, there's no way to do this.

Resources