Google Календар API дает 404 не найден на вставке события Ionic - PullRequest
0 голосов
/ 14 февраля 2019

Я пытаюсь добавить событие в календарь Google, но при вызове функции addEvent () я получаю сообщение об ошибке.ниже приведены методы, которые я использую для загрузки календаря и добавления к нему события.

initClient() {
    gapi.load('client', () => {
      console.log('loaded client')

      // It's OK to expose these credentials, they are client safe.
      gapi.client.init({
        apiKey: 'XXXXXXXXX',
        clientId: 'XXXXXXXXXX',
        discoveryDocs: ['https://www.googleapis.com/discovery/v1/apis/calendar/v3/rest'],
        scope: 'https://www.googleapis.com/auth/calendar.readonly'
      })

      gapi.client.load('calendar', 'v3', () => console.log('loaded calendar'));

    });

     }


      async addEvent(){
      const insert = await gapi.client.calendar.events.insert({
      calendarId: 'primary',
      start: {
        dateTime: hoursFromNow(2),
        timeZone: 'America/Los_Angeles'
      }, 
      end: {
        dateTime: hoursFromNow(3),
        timeZone: 'America/Los_Angeles'
      }, 
      summary: 'Have Fun!!!',
      description: 'Do some cool stuff and have a fun time doing it'
    })
    console.log("insert",insert);
    await this.getCalendar();
     }

Ответ

{
 "error": {
 "errors": [
 {
 "domain": "global",
 "reason": "notFound",
 "message": "Not Found"
 }

], «код»: 404, «сообщение»: «Не найдено "}}

...