繁体   English   中英

Java,C#,Python或Ruby中的Google Contacts API是否有Hello World示例?

[英]Is there a Hello World example for the Google Contacts API in Java, C#, Python or Ruby?

有人能指出我一步一步的例子,它解释了如何开始使用Google Contacts API并展示完整的工作演示?

最好是在Java中,但它也可以是C#,Python或Ruby。

目标

我想做的就是

  1. 加载现有联系人,
  2. 将它添加到一个组和
  3. 保存联系人。

问题

我几乎都失败了。

  • 无法使身份验证工作
  • 找不到包含我在Internet上找到的代码段中使用的类的库
  • 无法对现有联系人执行CRUD操作

这是我正在寻找的一些伪代码。

import com.google.contacts.*

public class UpdateContactDemo {

   public static void main(String args[]) {
      GoogleContactsApi g = new GoogleContactsApi("username", "password");
      Contact c = g.get("Bob");
      c.addGroup("Friends");
      g.save(c);
   }
}

我已经做了什么

好吧,我搜索了教程,API示例以及我能想到的所有其他内容 - 并且失败了。 我发现了一堆像这样的来源:

但不包含初学者的端到端示例。

我对C#的处理方法是这样的:

http://nanovazquez.com/2013/01/18/working-with-google-calendar-on-dotnet/

代码可以在github上找到: 这里

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  ...
  <appSettings>
    ...
    <!-- GoogleAPI credentials -->
    <add key="ClientId" value="{CLIENT-ID}" />
    <add key="ClientSecret" value="{CLIENT-SECRETD}" />

    <!-- Update the port of the Redirect URI (don't forget to set this value also in the Google API Console) -->
      <add key="RedirectUri" value="http://localhost:{PORT}/Account/GoogleAuthorization" />
  </appSettings>
  <system.web>
  ...
</configuration>
</xml>

您可以删除现有的Google日历API并添加Google通讯录Api。

试一试。

这有Oauth实现和工作,但code.google.com的代码示例没有。

到目前为止我发现的是最好的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM