https://developers.google.com/api-client-library/javascript/
https://code.google.com/p/google-api-javascript-client/
- access Developer Console Site.
- click
CREATE PROJECT
button. - click
APIs & auth > APIs
menu in left column. - trun on
Calendar API
button. - click
Credential
menu in left column. - copy
client ID
inClient ID for web application
section.
load Javascript client.
onload
parameter is to set a callback method name which will be called when client is initialized.
<script src="https://apis.google.com/js/client.js?onload=onLoadGapiClient"></script>
Following method is to auth. You can check about calendar auth information and auth method.
var config = {
'client_id': clientId,
'scope' : 'https://www.googleapis.com/auth/calendar',
'immediate': false
};
gapi.auth.authorize(config, $.proxy(this.handleAuthResult, this));
Following method is to get calendar information.
You can check about client method (gapi.client.calendar
)
var config = {
minAccessRole: 'owner'
},
request = gapi.client.calendar.calendarList.list(config);
request.execute(function(res){
console.log(res); // calendar informatino :)
});
here! :)