【问题标题】:google contacts api not adding name and address in google contact谷歌联系人 API 未在谷歌联系人中添加姓名和地址
【发布时间】:2013-12-24 12:44:43
【问题描述】:

我们在 cakephp 中通过 curl 发送 xml,但只添加了电子邮件和电话号码
谷歌联系人,其他字段为空白,我们可以获取适当的xml来添加谷歌中的所有字段 通过api联系 我们的xml代码:

 $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;

【问题讨论】:

标签: xml cakephp google-api google-contacts-api google-api-php-client


【解决方案1】:

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

【讨论】:

    【解决方案2】:

    现在这个 xml 正在工作

    $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" />
    

     EOF;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-10-08
      • 2011-10-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多