I want to import all events from Google calendar. In my code I will authenticate user first. Once user is sign in successfully then I will call below API using GET request.
https://www.googleapis.com/calendar/v3/calendars/my Email/events?key=my App Key&fields=items(id,start,summary,status,end)
I am getting response
{
"error": {
"errors": [
{
"domain": "global",
"reason": "notFound",
"message": "Not Found"
}
],
"code": 404,
"message": "Not Found"
}
}
Once I change my calendar as a public it will give all events details, but if calendar is mark as a private then it’s giving above response.
Any one having idea how to get events details from private calendar?
I think you may need add your access token to access your calendar information, if you use JavaScript library, you can take a look at these sample:
https://developers.google.com/api-client-library/javascript/features/authentication
I have implemented getCalendar using Angular JS + Ionic (using REST API)
https://developers.google.com/google-apps/calendar/v3/reference/
, but I am at work now, will send you later if you need it.
take a look at this example, you may understand how to attached yr request token to your request:
ionicExample.controller("DigitalOceanExample", function($scope, $http, $cordovaOauth) {
$scope.digitalOceanLogin = function() {
$cordovaOauth.digitalOcean("CLIENT_ID_HERE", "CLIENT_SECRET_HERE").then(function(result) {
window.localStorage.setItem("access_token", result.access_token);
}, function(error) {
console.log(error);
});
}
$scope.getDroplets = function() {
$http.defaults.headers.common.Authorization = "Bearer " + window.localStorage.getItem("access_token");
$http.get("https://api.digitalocean.com/v2/droplets")
.success(function(data) {
console.log(JSON.stringify(data.droplets));
})
.error(function(error) {
console.log(error);
});
}
});
I got the solution from this Google Developer console
LINK