I want to add an email address to one of my calendars inside a plugin for wordpress I am building. I am using the following function to do it. The access token is valid, that is not the problem. But I can see that the response to my request is a list of the existing emails in the calendar, instead of a object describing the email I added. And when i check the calendar I can see that the new email was not added. I want to make sure that my jQuery ajax settings are correct. The Google Calendar API doesn't explicitely say how to pass the access token but I saw one example doing it the way I am doing it below. If anyone has used jQuery Ajax to do a Google API request, I would appreciate it if you spot somethiing wrong. Below is the function I am usign to the the ajax request:
function insertACL() {
$.ajax({
url: 'https://www.googleapis.com/calendar/v3/calendars/[email protected]/acl',
data: {
access_token: google_access_token,
role: 'writer',
scope: {
type: "user",
value: "[email protected]"
}
},
success: function(resp) {
var user = resp;
console.log(user);
},
dataType: "jsonp"
});
add an email address to one of my calendars? Are you trying to add a user/owner to the calendar (with view/edit permissions), or are you trying to add an email to a specific event?