gpt4 book ai didi

delphi - 谷歌日历 API 德尔福

转载 作者:行者123 更新时间:2023-12-03 18:26:22 25 4
gpt4 key购买 nike

我一直在 DELPHI 编程,使用谷歌日历,我想删除一个事件,但我必须去 bug。

procedure TForm1.Button1Click (Sender: TObject);    
var
url: string;
slParam: TStringList;
begin
test: ='';
IdHTTP2.Request.CustomHeaders.Clear;
IdHTTP2.Request.Connection: = 'Keep-Alive';
IdHTTP2.Request.ContentType: = 'application / atom xml';
IdHTTP2.Request.CustomHeaders.Values ['GData-Version']: = '2';
IdHTTP2.Request.CustomHeaders.Values ['Authorization']: = 'GoogleLogin auth =' auth;
IdHTTP2.HandleRedirects: = true;
url: = http://www.google.com/calendar/feeds/u0qtqn2cke6pjppu1vgj5pj8js %40group.calendar.google.com/private/full
slParam: = TStringList.Create;
slParam.LoadFromFile ('udalit.xml');
try
test: = IdHTTP2.Post (url, slParam);
memo1.Lines.Add (test);
except
on E: EIdHTTPProtocolException do
ShowMessage (E.ErrorMessage);
end;
FreeAndNil (slParam);
end;

这是我要发送的 xml 文件
<?xml version="1.0" encoding="UTF-8" ?>   
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:app="http://www.w3.org/2007/app" xmlns:batch="http://schemas.google.com/gdata/batch" xmlns:gCal="http://schemas.google.com/gCal/2005" xmlns:gd="http://schemas.google.com/g/2005">
<category scheme="http://schemas.google.com/g/2005#kind" term="http://schemas.google.com/g/2005#event" />
<entry gd:etag=""FEUDQAdBfSp7JGA6WhJV"">
<batch:id>Delete itemD</batch:id>
<batch:operation type="delete" />
<id>http://www.google.com/calendar/feeds/u0qtqn2cke6pjppu1vgj5pj8js%40group.calendar.google.com/private/full/ihpe431ebmk9pa39dskjilnsko</id>
</entry>
</feed>

发送时会产生错误

[Line 1, Column 227] Invalid root element, expected (http://www.w3.org/2005/Atom:entry), got (http://www.w3.org/2005/Atom:feed)

最佳答案

看来您不需要发送文件来删除事件。根据Calendar API ,您只需要调用 URI。

To delete a calendar resource, send a DELETE request to a resource ID's feed URL. Include the Authorization header as described in Authenticating.

DELETE https://apps-apis.google.com/a/feeds/calendar/resource/2.0/{domain name}/{resourceId}

A successful response returns an HTTP 200 status code from the Google Data API status codes. The XML body of a successful response to a DELETE request is empty.

关于delphi - 谷歌日历 API 德尔福,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9308260/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com