如何通过 JavaScript 管理 Google 帐户的联系人?



我正在尝试通过JavaScript程序管理Google帐户联系人。当我尝试通过 JavaScript 删除联系人时,会发生此错误:"网络错误:405 不允许的方法。

这是我的代码:

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)
        }
    });
}

请帮助我,这可以通过JavaScript管理Google帐户的联系人吗?如果真的有可能,请告诉我管理Google帐户联系人的所有可能性。

还有其他可用的 JavaScript API 吗?

有没有其他解决方案?

我知道谷歌也列出了java,PHP,节点的解决方案,我正在用Nodejs编写服务器代码,但似乎是alpha版本中NodeJs的Google客户端代码,不确定管理联系人有多强大...

利用 google client api for javascript、Authenticate、getToken,然后使用 Request 然后执行它。根据需要传递方法和URL。出于删除目的,传递这些是其输入:

 method : 'DELETE',
 url : '/m8/feeds/contacts/default/full/<friend id to delete>'    

最新更新