calendarList.insert404
calendarList.insert 404
我正在使用 NodeJs
客户端,我想将日历添加到 calendarList。
The documentation 没有给出 javascript 例子,所以我试了一下。
createCalendar() {
return google.calendar({version: 'v3', auth: this.googleAuthConfig()})
.calendarList
.insert({requestBody: {}})
}
这会产生一个 404 响应,深入研究 gaxios
访问以下内容时会发生 404 响应调用
url = "https://www.googleapis.com/calendar/v3/users/me/calendarList"
method = "POST"
我在API explorer也试过了。并返回 404。
如何使用 javascript google API 将新日历插入我的日历列表?
在the method of "CalendarList: insert",当没有使用日历ID时,会出现这样的错误。当将无效值用作日历 ID 时,会发生错误。例如使用primary
时,会出现Invalid resource id value.
的错误。在这种情况下,请使用现有的日历 ID。请注意这一点。
要插入新日历时,请使用the method of "Calendars: insert"。示例脚本如下
Node.js 的示例脚本:
const calendar = google.calendar({ version: "v3", auth });
calendar.calendars.insert({
resource: {summary: "sample title"},
})
.then(({ data }) => console.log(data))
.catch(({ errors }) => console.log(errors));
Javascript 的示例脚本:
gapi.client.calendar.calendars.insert({
summary: "sample title"
})
.then(res => console.log(res))
.catch(err => console.log(err));
参考文献:
我正在使用 NodeJs
客户端,我想将日历添加到 calendarList。
The documentation 没有给出 javascript 例子,所以我试了一下。
createCalendar() {
return google.calendar({version: 'v3', auth: this.googleAuthConfig()})
.calendarList
.insert({requestBody: {}})
}
这会产生一个 404 响应,深入研究 gaxios
访问以下内容时会发生 404 响应调用
url = "https://www.googleapis.com/calendar/v3/users/me/calendarList"
method = "POST"
我在API explorer也试过了。并返回 404。
如何使用 javascript google API 将新日历插入我的日历列表?
在the method of "CalendarList: insert",当没有使用日历ID时,会出现这样的错误。当将无效值用作日历 ID 时,会发生错误。例如使用primary
时,会出现Invalid resource id value.
的错误。在这种情况下,请使用现有的日历 ID。请注意这一点。
要插入新日历时,请使用the method of "Calendars: insert"。示例脚本如下
Node.js 的示例脚本:
const calendar = google.calendar({ version: "v3", auth });
calendar.calendars.insert({
resource: {summary: "sample title"},
})
.then(({ data }) => console.log(data))
.catch(({ errors }) => console.log(errors));
Javascript 的示例脚本:
gapi.client.calendar.calendars.insert({
summary: "sample title"
})
.then(res => console.log(res))
.catch(err => console.log(err));