我创建了项目并使用https://code.google.com/apis/console注册了它 (我选择了“其他”应用程序类型)。然后我得到了已安装应用程序的“客户端 ID”。
然后我去控制台并创建事件,并使用 oauth 2 授权。 https://developers.google.com/google-apps/calendar/v3/reference/events/insert 一切正常。
POST https://www.googleapis.com/calendar/v3/calendars/primary/events?key={YOUR_API_KEY}
Content-Type: application/json
Authorization: xxx
X-JavaScript-User-Agent: Google APIs Explorer
{
"end": {
"dateTime": "2013-1-16T10:00:00.000-07:00"
},
"start": {
"dateTime": "2013-1-16T10:00:00.000-07:00"
}
}
回复
200 OK
- Show headers -
{
"kind": "calendar#event",
"etag": "\"WANTVF5ixxZ04U_VtQ0AZ3MbAlM/Z2NhbDAwMDAxMzY1NjU0MzAwNTk1MDAw\"",
"id": "2nsuis19mkp2q0uef54tl5nk68",
"status": "confirmed",
"htmlLink": "https://www.google.com/calendar/event?eid=Mm5zdWlzMTlta3AycTB1ZWY1NHRsNW5rNjggaXZhbjEzMzEzM0Bt",
"created": "2013-04-11T04:25:00.000Z",
"updated": "2013-04-11T04:25:00.595Z",
"creator": {
"email": "ivan133133@gmail.com",
"displayName": "ivan rozhcov",
"self": true
},
"organizer": {
"email": "ivan133133@gmail.com",
"self": true
},
"start": {
"dateTime": "2013-01-16T21:00:00+04:00"
},
"end": {
"dateTime": "2013-01-16T21:00:00+04:00"
},
"iCalUID": "2nsuis19mkp2q0uef54tl5nk68@google.com",
"sequence": 0,
"reminders": {
"useDefault": true
}
}
然后我复制了 id 并更新了这个事件。 https://developers.google.com/google-apps/calendar/v3/reference/events/update update 我第一次收到 200 响应。
PUT https://www.googleapis.com/calendar/v3/calendars/primary/events/2nsuis19mkp2q0uef54tl5nk68?key={YOUR_API_KEY}
Content-Type: application/json
Authorization: Bearer ya29.AHES6ZRmo6pdxj8pY4NmzdI1estRNB-v87XV7xQHgyhrWHk2rzs3Ke8
X-JavaScript-User-Agent: Google APIs Explorer
{
"end": {
"dateTime": "2013-1-16T10:00:00.000-07:00"
},
"start": {
"dateTime": "2013-1-16T10:00:00.000-07:00"
}
}
但是当我再次尝试时,我总是得到 400 错误,错误文本写在下面。
https://developers.google.com/google-apps/calendar/v3/reference/events/update更新
400 Bad Request
cache-control: private, max-age=0
content-encoding: gzip
content-length: 123
content-type: application/json; charset=UTF-8
date: Wed, 10 Apr 2013 12:49:29 GMT
expires: Wed, 10 Apr 2013 12:49:29 GMT
server: GSE
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Invalid Value"
}
],
"code": 400,
"message": "Invalid Value"
}
}
谁能解释一下,如果那是 google.api 错误,或者我在哪里弄错了?
我已经从differret帐户和PC上尝试过(通过Google APIs Explorer和python库,结果相同)
今天我试图重现那个错误。但是everring现在工作正常。我在谷歌代码中创建了一个问题 http://code.google.com/a/google.com/p/apps-api-issues/issues/detail?id=3371&thanks=3371&ts=1365599378 仍然没有答案。
我认为这是 temporaru 错误。