2

When something happens on my Linux server (low disk space, problems, etc.) I would like to know how could to automatically access Google Calendar and create an event in a specific calendar.

Is this possible?

  • Don't forget to assign the bounty to an answer or it will disappear. – codingbadger Mar 19 '11 at 10:18
  • sorry, I accepted the answer but did not figure out about the addtional bounty action (i thought just accepting would gave the bounty) – Open the way Mar 20 '11 at 11:10
  • Accepting the answer used to automatically award the bounty. The rules changed so that you can award bounties to answers other than your accepted answer. Thank you for awarding the bounty. Bounty FAQ – codingbadger Mar 20 '11 at 11:19
1
+100

Werner,

Using Google Calendar's API with JSON-C or ATOM seems to be a clean way to add events to your calendar. You may have to read up on how the authentication is processed, but the JSON code could be as simple as the following:


POST /calendar/feeds/default/private/full HTTP/1.1
Host: www.google.com 
Authorization: ... 
Content-Type: application/json
GData-Version: 2.0 
Content-Length: 233

{
 "data": {
   "title": "Tennis with Beth",
   "details": "Meet for a quick lesson.",
   "transparency": "opaque",
   "status": "confirmed",
   "location": "Rolling Lawn Courts",
   "when": [
     {
       "start": "2010-04-17T15:00:00.000Z",
       "end": "2010-04-17T17:00:00.000Z"
     }
   ]
 }
}

Here's the blog post that will help you to do just that.

1

Depending upon what language you are comfortable with, Google's calendar API seems like the best way to go.

All you would have to do have a executable script in your preferred language (Python, PHP, Java), implement authentication using the API and create event.

I would probably run the script as a cron job as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.