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

Ler*_*rve 14 c# ruby java google-api google-contacts-api

有人能指出我一步一步的例子,它解释了如何开始使用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);
   }
}
Run Code Online (Sandbox Code Playgroud)

我已经做了什么

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

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

rad*_*scu 1

我的 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>
Run Code Online (Sandbox Code Playgroud)

您可以删除现有的 Google Calendar api 并添加 Google Contacts Api。

尝试一下。

它具有 Oauth 实现并且有效,但 code.google.com 中的代码示例却没有。

是迄今为止我发现的最好的。