【问题标题】:Phone number obligatory on new contact entry新联系人条目必须提供电话号码
【发布时间】:2017-05-15 13:54:39
【问题描述】:

我想通过 Google Contacts API 发送 POST 请求。目前运行良好。

但我想知道如果我不指定电话号码,为什么我会收到 400 Bad Request Error

<?xml version="1.0" encoding="UTF-8"?>
 <errors xmlns="http://schemas.google.com/g/2005">
  <error>
   <domain>GData</domain>
   <code>invalid</code>
   <internalReason>Phone number must not be empty</internalReason>
  </error>
 </errors>

如果有人知道我是否可以绕过它?

请注意,当您在Google Contacts 添加联系人时,没有此限制。

【问题讨论】:

  • 您是否有可以分享的原始请求的副本?电话号码不是必需的,但如果您的电话号码字段为空,则会触发该错误。

标签: google-api google-contacts-api


【解决方案1】:

您收到该错误是因为文档中说明需要为这些扩展元素提供rel attributelabel attribute

在联系人数据 API 中,有几个元素稍微多一些 比 Contact 类型的文档中说明的限制。 特别是,客户端必须提供 rel 属性或标签 属性,但不能同时用于以下元素:

gd:email gd:im gd:organization gd:phoneNumber gd:postalAddress

简而言之,您确实需要提供电话号码。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-03
    • 2018-01-26
    • 2016-06-28
    • 1970-01-01
    • 1970-01-01
    • 2011-04-12
    相关资源
    最近更新 更多