如何通过 JavaScript 管理 Google 帐户的联系人? [英] How can I manage Google account's contacts through JavaScript?

查看:41
本文介绍了如何通过 JavaScript 管理 Google 帐户的联系人?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

这是我的代码:

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 帐户联系人的所有可能性....

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

还有其他可用的 JavaScript API 吗?

Is there any other JavaScript API available?


有什么替代方案吗?

我知道谷歌也列出了 Java、PHP 和节点的解决方案,我正在用 Nodejs 编写服务器代码,但看起来像 Alpha 版 NodeJs 的谷歌客户端代码,不确定管理联系人的能力有多强...


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

推荐答案

利用 用于 javascript 的谷歌客户端 api,验证,getToken,然后使用 Request 然后执行它.根据您的需要传递方法和网址.为了删除目的,传递这些是它的输入:

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

这篇关于如何通过 JavaScript 管理 Google 帐户的联系人?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆