【问题标题】:Google API feed batch delete error 500Google API Feed 批量删除错误 500
【发布时间】:2018-05-23 21:20:00
【问题描述】:

我想删除 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。

我不知道我的问题出在哪里。有人有想法吗?

非常感谢,

【问题讨论】:

标签: php google-api-php-client


【解决方案1】:

感谢@Morfinismo,我解决了这个问题。

  • 我将方法“DELETE”更改为“POST”
  • 我在标头请求中添加了“If-Match: *”
  • 我将“id”替换为“editURL”

就是这样。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多