Reputation: 3213
I implemented Google Calendar
with its API on a website using ReactJs
and NodeJs.
My code looks like this (simplified) :
import { google } from 'googleapis'
const calendar = google.calendar('v3')
...
async eventsDelete(calendarId, eventId) {
try {
const res = await calendar.events.delete({
calendarId: calendarId,
eventId: eventId
})
return res
} catch (exception) {
console.log(exception)
return false
}
}
The request works perfectly well with one Event ID. However, in some situations, I may have to delete way more than one event in a short amount of time. This may lead my users to face quotas error.
I don't need to have different calendar IDs in one request, only different event IDs. I'm here not talking about deleting the whole calendar, but a significant amount of events in it whose IDs come from a events.ist
I get by searching with a specific extendedProperties
.
Is it possible to delete more than one event in one query, without using batch
( it doesn't prevent quota issues ), to reduce quota issues?
Thanks in advance.
Upvotes: 0
Views: 1676
Reputation: 116918
If you check the documentation event.delete method You will notice that it says an event this is singular. you must send a single event id to the method. If you want to delete more then one your going to have to loop over them and make a request for each event you wish to delete.
Batching will not help with quota your still making the same number of calls there is no way to get around sending one call for each event you wish to delete or avoiding the quota cost for sending multiple requests to the api. If you are having quota limitations issues you should request an extension.
Upvotes: 1