[英]Google Calendar API doesn't return all events
I integrated the google API in my react project.我在我的 React 项目中集成了 google API。 I have about 300 Entries in my calendar but I only receive about 180 entries.
我的日历中有大约 300 个条目,但我只收到大约 180 个条目。
What is my Mistake?我的错误是什么?
Tank you!保护你!
const getEvents = async () => {
function start() {
gapi.client
.init({
apiKey: "MyKey",
})
.then(function () {
return gapi.client.request({
path: `https://www.googleapis.com/calendar/v3/calendars/"myMail"/events`,
});
})
.then((response) => {
let events = response.result.items;
console.log(events);
setEventObject(events);
});
}
gapi.load("client", start);
};
UPDATE This doesn't work.更新这不起作用。 It seems like the additional parameters has no impact of the request...
似乎附加参数对请求没有影响......
const getEvents = () => {
function start() {
gapi.client
.init({
apiKey: "myKey",
})
.then(function () {
return gapi.client.request({
path: `https://www.googleapis.com/calendar/v3/calendars/"myMail"/events`,
maxResults: 2500,
showDeleted: true,
});
})
.then((response) => {
let events = response.result.items;
console.log(events);
setEventObject(events);
});
}
gapi.load("client", start);
};
Your passing your parameters the wrong way through the request.您通过请求以错误的方式传递参数。 Checkout the google github
查看谷歌 github
You need to pass the params
URL params in key-value pair form.您需要以键值对形式传递
params
URL 参数。
return gapi.client.request({
path: `https://www.googleapis.com/calendar/v3/calendars/"myMail"/events`,
params: { maxResults: 2500, showDeleted: true }
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.