2

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...

Laique Ali
  • 57
  • 2
  • 8

1 Answers1

2

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>'    
sufyan.shoaib
  • 1,117
  • 9
  • 19
  • sufyan.shoaib - How do you get the contactID for the URL you provided? – Angelo Nov 04 '13 at 16:49
  • 1
    When you do a call to get contacts from google, they provide it in response xml. You need to parse it to get the contact id. Like you will get tag with a tag like this one: . And you just need to parse it, can use 2/8282828282 as contactId. Hope this will help you – sufyan.shoaib Nov 05 '13 at 06:53