如何为重复发生的Google日历活动

时间:2018-01-17 00:55:08

标签: json google-calendar-api

我的代码是使用Google日历API创建Google日历条目(定期事件)。这工作正常。现在我试图为某些实例添加例外。我已经让它适用于已删除的实例(通过使用EXDATE参数),但我无法更改实例的日期/时间。我按照此处的说明进行操作:

https://developers.google.com/google-apps/calendar/recurringevents

在创建基本的重复事件后,我检索所有实例的列表。为了进行测试,我将提取适用于我想要更改的实例的整个json部分,例如:

{
        "kind": "calendar#event",
        "etag": "\"3032281375946000\"",
        "id":   "_69j3ge9iccp68or1c8p3ac1nccpm8p356gpj8pb66koj2c32c5h0_20180130T203000Z",
        "status":   "confirmed",
        "htmlLink": "https://www.google.com/calendar/event?eid=XzY5ajNnZTlpY2NwNjhvcjFjOHAzYWMxbmNjcG04cDM1NmdwajhwYjY2a29qMmMzMmM1aDBfMjAxODAxMzBUMjAzMDAwWiBqbWNrYXk5MzUxQG0",
        "created":  "2018-01-16T20:08:56.000Z",
        "updated":  "2018-01-17T00:13:59.277Z",
        "summary":  "Recurring test with deletes and changes",
        "description":  "\n",
        "location": "SEattle",
        "creator":  {
            "email":    "jmckay9351@gmail.com",
            "displayName":  "Jeffrey McKay",
            "self": true
        },
        "organizer":    {
            "email":    "jmckay9351@gmail.com",
            "displayName":  "Jeffrey McKay",
            "self": true
        },
        "start":    {
            "dateTime": "2018-01-30T13:30:00-08:00"
        },
        "end":  {
            "dateTime": "2018-01-30T14:00:00-08:00"
        },
        "recurringEventId": "_69j3ge9iccp68or1c8p3ac1nccpm8p356gpj8pb66koj2c32c5h0",
        "originalStartTime":    {
            "dateTime": "2018-01-30T12:30:00-08:00"
        },
        "iCalUID":  "2f892c2dcab2507c3dde434ef5110bab",
        "sequence": 0,
        "reminders":    {
            "useDefault":   false,
            "overrides":    [{
                    "method":   "popup",
                    "minutes":  15
                }]
}
}

然后我将此数据的http PUT写入此URL:

https://www.googleapis.com/calendar/v3/calendars/jmckay9351@gmail.com/events/_69j3ge9iccp68or1c8p3ac1nccpm8p356gpj8pb66koj2c32c5h0_20180130T203000Z

我得到的是http错误400,返回的json中的错误消息是“Missing end time”。无论我向PUT输入多少或几乎没有数据,我都得到相同的响应。知道我在这里做错了吗?

1 个答案:

答案 0 :(得分:0)

好的我现在已经开始工作了 - 我不明白我的libcurl PUT代码出了什么问题,但我把它改成了一个带有“PUT”自定义请求的POST,它似乎正确地获取了数据上传。