Вопрос

I'm trying to manage Google account contacts through JavaScript programs. When I'm trying to delete contacts through JavaScript, this error occurs: "Network Error: 405 Not Allowed Method."

Here is My Code:

function deleteContacts() {
    $.ajax({
        type: 'DELETE',
        url: 'https://www.google.com/m8/feeds/contacts/default/full/{client_Id}?access_token=' + tokenId,
        headers: {
            'If-Match': '*',
            'Gdata-version': '3.0'
        },
        dataType: 'jsonp',
        data: {},
        success: function (data) {
            console.log("response: " + data)
        }
    });
}

Please help me in this, is this possible to manage Google account's contacts through JavaScript? If it is really possible then please tell me all possibilities for managing Google account's contacts....

Is there any other JavaScript API available?


Is there any alternate solution?


I Know Google has listed solutions in java, PHP, nodes as well, and I am writing server code in Nodejs, but seems like Google client code for NodeJs in alpha version, not sure how much strong it is to manage contacts...

Это было полезно?

Решение

Make use of the google client api for javascript, Authenticate, getToken and then use Request and then execute it. Pass on the method and url as per your need. For delete purpose, pass these are its input:

 method : 'DELETE',
 url : '/m8/feeds/contacts/default/full/<friend id to delete>'    
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top