It is possible to do this from the browser, although not obvious at all.
Based on this SO answer, we learn that there is method called gapi.client.request
that can be used for this (instead of jQuery's $.ajax
).
Accordingly, for editing we can do:
gapi.client.request({
method : 'PUT',
path:'m8/feeds/contacts/default/full/<contactId>/<editRevisionFromGET>',
body : {"version":"1.0","encoding":"UTF-8","entry": ...},
callback : function(data) {
console.log(data);
}
});
The important parts for editing in here are:
- send back the entire entry you got before from a read
- use the current ID given at the end of the URL in the
entry.link
element with relation typeedit
(or you'll get a HTTP Status 409 - Conflict)
Side note:
Notice that these requests actually are done to https://content.googleapis.com/
...
From some quick tests, it seems you can do ?all? requests just to that URL instead of google.com, and then CORS issues disappear.