Google API 饲料批次删除错误 500
Google API feed batch delete error 500
我想删除具有 Google API 个供稿的联系人列表。
我生成以下 XML 正文:
<?xml version="1.0"?>
<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>
<batch:id>delete</batch:id>
<batch:operation type="delete"/>
<id>http://www.google.com/m8/feeds/contacts/<email>/base/c001f30f8a96bd</id>
</entry>
<entry>
<batch:id>delete</batch:id>
<batch:operation type="delete"/>
<id>http://www.google.com/m8/feeds/contacts/<email>/base/13112ef0ace9063</id>
</entry>
</feed>
在那之后,我打电话给 Google_Http_Request
$req = new \Google_Http_Request('https://www.google.com/m8/feeds/contacts/default/full/batch/');
$req->setRequestHeaders(array('content-type' => 'application/atom+xml; charset=UTF-8; type=feed'));
$req->setRequestMethod('DELETE');
$req->setPostBody($myXML);
Google 给我一个错误 500。
我不知道我的问题出在哪里。有人有想法吗?
非常感谢,
我解决了这个问题,感谢@Morfinismo。
- 我把方法'DELETE'改成了'POST'
- 我在 header 请求中添加了 'If-Match: *'
- 我用 'editURL'
替换了 'id'
就是这样。
我想删除具有 Google API 个供稿的联系人列表。
我生成以下 XML 正文:
<?xml version="1.0"?>
<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>
<batch:id>delete</batch:id>
<batch:operation type="delete"/>
<id>http://www.google.com/m8/feeds/contacts/<email>/base/c001f30f8a96bd</id>
</entry>
<entry>
<batch:id>delete</batch:id>
<batch:operation type="delete"/>
<id>http://www.google.com/m8/feeds/contacts/<email>/base/13112ef0ace9063</id>
</entry>
</feed>
在那之后,我打电话给 Google_Http_Request
$req = new \Google_Http_Request('https://www.google.com/m8/feeds/contacts/default/full/batch/');
$req->setRequestHeaders(array('content-type' => 'application/atom+xml; charset=UTF-8; type=feed'));
$req->setRequestMethod('DELETE');
$req->setPostBody($myXML);
Google 给我一个错误 500。
我不知道我的问题出在哪里。有人有想法吗?
非常感谢,
我解决了这个问题,感谢@Morfinismo。
- 我把方法'DELETE'改成了'POST'
- 我在 header 请求中添加了 'If-Match: *'
- 我用 'editURL' 替换了 'id'
就是这样。