Brad Brad - 6 months ago 60
AngularJS Question

how to read events in public google calendar using angular

I have a google calendar that I have embedded in my site but I want to be able to pull the event details from the calendar (date, time, event description, address) and read it using angular so I can reformat it and display it however I want on my page.

I do not need to interact with it (meaning update, delete, edit anything), just pull the events from it.

Is this possible with an Angular API (or some other call)?

Answer

Yes, it is possibile because Google provides Google Calendar APIs

First of all, you have to turn on the API for your calendar, using this link: Google APIs wizard

Then you can follow the API reference provided by Google itself and just do GET/POST request to the listed endpoints.
Google calendar API reference

EDIT: author asked some Angular example to performs HTTP requests. This is a sample of code to perform a simple GET request to get calendarId entries:

$http({
  method: 'GET',
  url: 'https://www.googleapis.com/calendar/v3/users/me/calendarList/' +calendarId
}).then(function successCallback(response) {
    // this callback will be called asynchronously
    // when the response is available
  }, function errorCallback(response) {
    // called asynchronously if an error occurs
    // or server returns response with an error status.
  });

If you are asking such a question, probably this answer is not gonna be enough and i don't think this is the best place to provide a wide-enough explaination of the subject (and probably i am not the best teacher). Take a look at the official Angular HTTP documentation for some more examples and a more complete explaination

Comments