Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google contact api returns Invalid XML Document error

While adding contacts using google contacts api, I have been getting status code 400, with Invalid XML Document error.

If I remove the following line the add contact api succeeds. However, this behaviour is not what I want. I would like to add it to the base group 6.

<gContact:groupMembershipInfo deleted="false"
          href="http://www.google.com/m8/feeds/groups/[email protected]/base/6"/>

The following is the body of the add new contact api post request:

<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" />
  <gd:name>
    <gd:givenName>1234567890</gd:givenName>
  </gd:name>
  <gd:phoneNumber rel="http://schemas.google.com/g/2005#mobile" primary="true">
    ${phone_number}
  </gd:phoneNumber>
  <gContact:groupMembershipInfo deleted="false" href="http://www.google.com/m8/feeds/groups/[email protected]/base/6" />
</atom:entry>
like image 583
Vinthi Avatar asked Mar 05 '23 23:03

Vinthi


1 Answers

I solved the problem changing the tag <gContact:groupMembershipInfo>in <gd:groupMembershipInfo> , so any tag with <gContact> no longer works but only with <gd:>, this only when you create new contact if you update there isn't any problem

like image 128
JohnJ Avatar answered Apr 28 '23 10:04

JohnJ