I am using google task API for inserting tasks in google tasks & it's also working properly when I am only adding one task at a time but the problem came when I am inserting multiple tasks in one go. I tried every resource that I know but still didn't get any.
I am using react.js as the front end.
Any help or sharing is most appreciated.
Docs that I used => https://developers.google.com/tasks/reference/rest/v1/tasklists/insert?apix_params=%7B%22resource%22%3A%7B%22title%22%3A%22T1%22%7D%7D
My code:-
function addManualTasks() {
const tasks = [
{ title: 'Task 1', notes: 'This is the first task' },
{ title: 'Task 2', notes: 'This is the second task' },
];
// Inserting in the array form
// gapi.client.tasks.tasks.insert({ tasklist: 'MTc0MTY5NjA3MTc2ODY1MDAwNjk6MDow', resource:tasks}).then(res => console.log('res', res))
// Inserting in the object of array form
gapi.client.tasks.tasks
.insert({
tasklist: 'MTc0MTY5NjA3MTc2ODY1MDAwNjk6MDow',
resource: { items: tasks },
})
.then((res) => console.log('res', res));
}