插入Google API时如何设置日历ID? [英] How do you set a Calendar ID when inserting in Google API?

查看:125
本文介绍了插入Google API时如何设置日历ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Google文档中将测试API用于 calendar.calendars时.insert 设置这样的请求时,我总是得到Invalid resource id value.作为响应

When using the test API in Google's documentation for calendar.calendars.insert I always get back Invalid resource id value. as a response when setting the request like this

{
    "summary": "Events",
    "description": "This is where you will keep your events",
    "id": "test.events"
}

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

The documentation says that the id can be any string as long as it doesn't have two consecutive dots and it is longer than 0 and shorter than 101.

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

What am I doing wrong? I would like to be able to set the id so I don't have to store the id that has random characters in my database.

推荐答案

您未设置Google为其分配的日历ID的日历ID.

You don't set the calendar ID Google Assignes it a Calendar id.

我认为日历ID是主键,因此必须唯一. Google不允许您插入自己的ID,因为那样他们就不得不假设每个程序员都首先检查它们是否还没有具有该ID的程序员.

I would assume a Calendar IDs is a primary key and there for must be unique. Google cant allow you to insert your own because then they would have to assume that every programmer bothered to check first that they didn't have one with that ID already.

这篇关于插入Google API时如何设置日历ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆