好的,首先,如果这个问题得到解答,请简单地指出我正确的方向。我没有找到我遇到的答案就进行了搜索和搜索。
以下是该方案,我有一个应用程序需要能够执行以下操作:
到目前为止,我已经完成了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 Developer Center并使用Events:update测试区域,则这是生成的网址:
https://www.googleapis.com/calendar/v3/calendars/{CALENDAR ID}/events/dbqcfrdvkm40tnuvbk46mv1ktg?key={YOUR_API_KEY}
如果我从那里测试它就可以正常工作,所以我现在完全被难倒了,所以任何有效的,有用的想法都会受到欢迎。
答案 0 :(得分:2)
我会说你的{CALENDAR ID}无效。你从哪里获得这个价值?
也可以使用默认为用户主日历的“主要”日历ID。
此外,在更新活动时,您应该使用PUT
HTTP动词https://developers.google.com/google-apps/calendar/v3/reference/events/update