插入Google API时如何设置日历ID?

Ada*_*nan 5 google-calendar-api google-api

在Google文档中使用calendar.calendars.insert的文档中的测试API Invalid resource id value.时,在设置此类请求时,我总是作为响应返回

{
    "summary": "Events",
    "description": "This is where you will keep your events",
    "id": "test.events"
}
Run Code Online (Sandbox Code Playgroud)

该文档说,id只要没有连续两个点,并且长度大于0且小于101,它可以是任何字符串。

我究竟做错了什么?我希望能够设置,id所以我不必在数据库中存储具有随机字符的id。

DaI*_*mTo 2

您没有设置日历 ID,Google 会为其分配日历 ID。

我假设日历 ID 是主键,并且必须是唯一的。Google 不能允许您插入自己的 ID,因为那样他们就必须假设每个程序员都会费心首先检查他们是否已经拥有具有该 ID 的 ID。