首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >google contacts api未在google contact中添加姓名和地址

问google contacts api未在google contact中添加姓名和地址
EN

Stack Overflow用户
提问于 2013-12-24 20:44:44
回答 2查看 1.1K关注 0票数 1

我们在cakephp中通过curl发送xml,但只添加了电子邮件和电话号码

google联系人,其他字段为空,我们是否可以通过api我们的xml代码获得适当的xml来添加google联系人中的所有字段:

代码语言:javascript
复制
 $xml = <<<'EOF'
 <atom:entry xmlns:atom='http://www.w3.org/2005/Atom'    
 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#contact'/>

   <title type="text">TITLE</title>
  <gd:name>
 <gd:givenName>First</gd:givenName>
 <gd:additionalName>ADDITIONALNAME</gd:additionalName>
 <gd:familyName>Last</gd:familyName>
 <gd:namePrefix>NAMEPREFIX</gd:namePrefix>
 <gd:nameSuffix>NAMESUFFIX</gd:nameSuffix>
  </gd:name>
 <gd:structuredPostalAddress rel='http://schemas.google.com/g/2005#work' primary='true'>
 <gd:city>CITY</gd:city>
 <gd:street>STREET</gd:street>
 <gd:region>REGION</gd:region>
<gd:postcode>POSTCODE</gd:postcode>
<gd:country>COUNTRY</gd:country>
 </gd:structuredPostalAddress>
<gd:phoneNumber rel='http://schemas.google.com/g/2005#home' primary='true'>
  HOMEPHONENUMBER
</gd:phoneNumber>\
<gd:phoneNumber rel='http://schemas.google.com/g/2005#mobile'>MOBILENO</gd:phoneNumber>
<gd:phoneNumber rel='http://schemas.google.com/g/2005#work'>WORKPHONENO</gd:phoneNumber>
<gd:email label="home" address="EMAILADDRESS" displayName="DISPLAYNAME" />
</atom:entry>
EOF;
EN

回答 2

Stack Overflow用户

发布于 2016-01-31 09:26:45

我们需要将此标头gdata-version: 3.0与授权标头一起添加到post调用中。这个答案已经是here了

票数 1
EN

Stack Overflow用户

发布于 2014-02-05 18:20:45

现在,这个xml可以工作了

代码语言:javascript
复制
$xml = <<<'EOF'
<atom:entry xmlns:atom='http://www.w3.org/2005/Atom'     
  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#contact'/>

 <atom:title>Full Name</atom:title>

<gd:name>
<gd:givenName>CODE1</gd:givenName>
<gd:familyName>Last</gd:familyName>
<gd:fullName>My Name</gd:fullName>

</gd:name>

<gd:structuredPostalAddress rel='http://schemas.google.com/g/2005#work' primary='true'>
<gd:city>CITY</gd:city>
<gd:street>STREET</gd:street>
<gd:region>REGION</gd:region>
<gd:postcode>POSTCODE</gd:postcode>
<gd:country>COUNTRY</gd:country>

</gd:structuredPostalAddress>

 <gd:phoneNumber rel='http://schemas.google.com/g/2005#home' primary='true'>
 HOMEPHONENUMBER

</gd:phoneNumber>

<gd:phoneNumber rel='http://schemas.google.com/g/2005#mobile'>MOBILENO</gd:phoneNumber>

<gd:phoneNumber rel='http://schemas.google.com/g/2005#work'>WORKPHONENO</gd:phoneNumber>

<gd:email label="home" address="EMAILADDRESS" displayName="DISPLAYNAME" />

​

代码语言:javascript
复制
 EOF;
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20761210

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档