使用Google Contacts API进行批处理 - PHP

时间:2015-04-16 17:51:28

标签: php batch-processing google-contacts

我一直在使用Google Contacts API(v3),并且遇到了批处理问题。当我打电话时(使用curl),我得到的全部是:

<?xml version="1.0" encoding="UTF-8"?>
    <errors xmlns="http://schemas.google.com/g/2005">
    <error/>
</errors>

这不是非常有用。我在单一记录处理方面取得了成功,但这批产品是一个问题。我使用的网址是:

 https://www.google.com/m8/feeds/contacts/default/full/batch

使用适当的标头进行身份验证。我的XML输入是:

<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
      xmlns:gContact='http://schemas.google.com/contact/2008'
      xmlns:gd='http://schemas.google.com/g/2005'
      xmlns:batch='http://schemas.google.com/gdata/batch'>
<entry gd:etag='"SX09eTVSLit7I2A9XRRaEU4CRwY."'>
    <batch:id>update</batch:id>
    <batch:operation type='update'/>
    <category scheme='http://schemas.google.com/g/2005#kind' term='http://schemas.google.com/g/2008#contact'/>
    <id>http://www.google.com/m8/feeds/contacts/awallace%40ihouseweb.com/base/21df3130886ecccb</id>
    <gContact:externalId label="enduser_acnt"  value="6006838" />
    <gd:name>
        <gd:givenName>Cleopatra</gd:givenName>
        <gd:familyName>Hewlett-Jones</gd:familyName>
    </gd:name>
    <updated>2015-04-15 15:47:08</updated>
    <title type="text">Cleopatra Hewlett-Jones</title>
    <gd:structuredPostalAddress rel="http://schemas.google.com/g/2005#home" primary="true">
        <gd:street>12 Override St</gd:street>
        <gd:city>Overridden</gd:city>
        <gd:region>AZ</gd:region>
        <gd:postcode>85253</gd:postcode>
    </gd:structuredPostalAddress>
    <gd:email rel="http://schemas.google.com/g/2005#home" address="cleo123456@nile.com" primary="true" />
    <gd:phoneNumber rel="http://schemas.google.com/g/2005#home" primary="true" >333-444-5555</gd:phoneNumber>
    <gContact:groupMembershipInfo deleted='false' href='http://www.google.com/m8/feeds/groups/awallace%40ihouseweb.com/base/7998a9d20900fb66'/>
    <gContact:groupMembershipInfo deleted='false' href='http://www.google.com/m8/feeds/groups/awallace%40ihouseweb.com/base/51ecb7c40e26f4f5'/>
</entry>
</feed>

我已经验证了XML,据我所知,从文档中它是正确的(并且工作正常,没有批处理包装器在非批处理模式下),并且url是正确的。有什么建议吗?

谢谢, 安迪

0 个答案:

没有答案