好的,首先,如果已经回答了这个问题,请简单地指出我正确的方向。我已经搜索和搜索,但无法找到我遇到的问题的答案。
这是场景,我有一个需要能够执行以下操作的应用程序:
- 获取指定日历的事件列表
- 确定事件的开始和结束时间
- 如果开始时间不正确(即我们在 6:01 而不是 6:00 创建了事件),则需要调整开始时间
- 发送 POST 请求以更新开始和结束时间
到目前为止,我已经完成了 1-3 次,没有问题,我的问题在第 4 位。我有一个事件列表,我已经修改了时间并创建了发布请求,但是,它总是返回“未找到”回应,我完全糊涂了。
这是我在请求事件列表时得到的部分响应:
[1] => stdClass Object
(
[kind] => calendar#event
[etag] => "ZrhdJMCgpoUK_a5fT7XOC6xn46g/Z2NhbDAwMDAxMzU4NjE3MzM1NDE1MDAw"
[id] => dbqcfrdvkm40tnuvbk46mv1ktg
[status] => confirmed
[htmlLink] => ########################
[created] => 2013-01-19T17:42:15.000Z
[updated] => 2013-01-19T17:42:15.415Z
[summary] => #########################
[description] => ########################
[location] => Traverse City, MI
[creator] => stdClass Object
(
[email] => ######################
)
[organizer] => stdClass Object
(
[email] => ##################################
[displayName] => Kent County
[self] => 1
)
[start] => stdClass Object
(
[dateTime] => 2013-01-19T13:01:00-05:00
[timeZone] => America/New_York
)
[end] => stdClass Object
(
[dateTime] => 2013-01-19T16:01:00-05:00
[timeZone] => America/New_York
)
[recurrence] => Array
(
[0] => RRULE:FREQ=WEEKLY;UNTIL=20130331T000000Z
)
[iCalUID] => ###############################
[sequence] => 0
[attendees] => Array
(
[0] => stdClass Object
(
[email] => ####################
[displayName] => ##############
[responseStatus] => needsAction
)
)
[reminders] => stdClass Object
(
[useDefault] => 1
)
)
如您所见,我毫无问题地获得了活动 ID,然后我转身使用日历 ID 和我刚刚收到的活动 ID 创建发布请求
https://www.googleapis.com/calendar/v3/calendars/{CALENDAR ID}/events/dbqcfrdvkm40tnuvbk46mv1ktg?key={API KEY}
这就是我卡住的地方,我得到的唯一响应是“未找到”,即使与请求一起发送的标头看起来不错
Array
(
[url] => https://www.googleapis.com/calendar/v3/calendars/{CALENDAR ID}/events/dbqcfrdvkm40tnuvbk46mv1ktg?key={API KEY}
[content_type] => text/html; charset=UTF-8
[http_code] => 404
[header_size] => 360
[request_size] => 485
[filetime] => -1
[ssl_verify_result] => 0
[redirect_count] => 0
[total_time] => 0.364634
[namelookup_time] => 3.0E-5
[connect_time] => 0.08616
[pretransfer_time] => 1.7E-5
[size_upload] => 105
[size_download] => 9
[speed_download] => 24
[speed_upload] => 287
[download_content_length] => -1
[upload_content_length] => 105
[starttransfer_time] => 0.3646
[redirect_time] => 0
[certinfo] => Array
(
)
[redirect_url] =>
[request_header] => POST /calendar/v3/calendars/{CALENDAR ID}/events/dbqcfrdvkm40tnuvbk46mv1ktg?key={API KEY} HTTP/1.1
Host: www.googleapis.com
Accept: */*
Content-Type: application/json
Authorization: Bearer {SECURITY TOKEN}, X-JavascriptUser-Agent: HiddenOnes
Content-Length: 105
)
如果我去 Google 开发者中心并使用 Events:update 测试区,这是生成的 url:
https://www.googleapis.com/calendar/v3/calendars/{CALENDAR ID}/events/dbqcfrdvkm40tnuvbk46mv1ktg?key={YOUR_API_KEY}
如果我从那里测试它,它工作得很好,所以我现在完全被难住了,所以任何有效的、有用的想法都会受到欢迎。