【问题标题】:Creating Google Group contact创建 Google 群组联系人
【发布时间】:2016-10-11 13:20:38
【问题描述】:

我正在尝试使用 Google 通讯录 v3 创建群组联系人。

按照示例并在 OAuth 2.0 Playground 中进行测试,这是我的示例代码:

POST /m8/feeds/groups/default/full/ HTTP/1.1
Host: www.google.com
Gdata-version: 3.0
Content-length: 355
Content-type: application/atom+xml
Authorization: Bearer #{auth_code_goes_in_here}#
<atom:entry xmlns:gd="http://schemas.google.com/g/2005">
  <atom:category scheme="http://schemas.google.com/g/2005#kind"
    term="http://schemas.google.com/contact/2008#group"/>
  <atom:title type="text">Salsa group</atom:title>
  <gd:extendedProperty name="more info about the group">
    <info>Nice people.</info>
  </gd:extendedProperty>
</atom:entry>

但是,我在响应中不断收到 400 错误:

HTTP/1.1 400 Bad Request
Alternate-protocol: 443:quic,p=1
Content-length: 236
X-xss-protection: 1; mode=block
X-content-type-options: nosniff
Transfer-encoding: chunked
Expires: Fri, 11 Mar 2016 05:18:06 GMT
Vary: Origin, X-Origin
Server: GSE
-content-encoding: gzip
Cache-control: private, max-age=0
Date: Fri, 11 Mar 2016 05:18:06 GMT
X-frame-options: SAMEORIGIN
Alt-svc: quic=":443"; ma=2592000; v="31,30,29,28,27,26,25"
Content-type: application/vnd.google.gdata.error+xml; charset=UTF-8
<?xml version="1.0" encoding="UTF-8"?>
<errors xmlns="http://schemas.google.com/g/2005">
 <error>
  <domain>GData</domain>
  <code>invalid</code>
  <internalReason>Entry does not have any fields set</internalReason>
 </error>
</errors>

有什么想法我在这里做错了吗?

除此之外,我想在 Google 中创建联系人,并附上特定的组。这可以通过“创建联系人”方法实现吗?我似乎找不到可以直接指定组的示例。

感谢您的任何建议。

问候, 乐华

【问题讨论】:

  • 当我使用 OAuth 2.0 Playground 测试添加联系人时,它起作用了。它仅不适用于创建联系人组。因此,我相信我的问题可能与此不同。

标签: google-api google-contacts-api


【解决方案1】:

经过一番痛苦的研究,我通过更改以下数据找到了解决方案:

<atom:entry xmlns:gd="http://schemas.google.com/g/2005">
to
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:gd="http://schemas.google.com/g/2005">

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-11-16
    • 2022-01-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多