dipanshu
dipanshu

Reputation: 197

google contacts api not adding name and address in google contact

we are sending xml through curl in cakephp, but only email and phone numbers are adding in
google contacts , other fields are blank,can we get proper xml to add all fields in google contacts through api our xml code:

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

Upvotes: 1

Views: 1131

Answers (2)

Nishanth
Nishanth

Reputation: 327

We need to add this header gdata-version: 3.0 along with the Authorization header to the post call. This answer is already here

Upvotes: 1

dipanshu
dipanshu

Reputation: 197

now this xml is working

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

Upvotes: 0

Related Questions