在Google Calendar API中插入期间的解析错误



我有一个JSON对象,并以urlparameter

将其传递给它
{
  "end": {
    "dateTime": "2017-10-09T13:30:00",
    "timeZone": "America/Denver"
  },
    "start": {
  "dateTime": "2017-10-09T12:00:00",
    "timeZone": "America/Denver"
  },
  "description": "Added through API",
  "summary": "Lecture on Global Warming",
  "location": "Denver"
}

我还将Content-Type设置为application/json。但是我将错误作为

{ 
    "error": 
    { 
       "errors": [ { 
            "domain": "global", 
            "reason": "parseError", 
            "message": "Parse Error" } ], 
       "code": 400, 
       "message": "Parse Error" 
    }
}

通过尝试此API发送相同的请求时,其工作正常。请帮助!

如果您要在实际编码中执行此操作,请使用' apostrophes'而不是" double quotes"。

var event = {
  'summary': 'Google I/O 2015',
  'location': '800 Howard St., San Francisco, CA 94103',
  'description': 'A chance to hear more about Google's developer products.',
  'start': {
    'dateTime': '2015-05-28T09:00:00-07:00',
    'timeZone': 'America/Los_Angeles',
  },
  'end': {
    'dateTime': '2015-05-28T17:00:00-07:00',
    'timeZone': 'America/Los_Angeles',
  },
  'recurrence': [
    'RRULE:FREQ=DAILY;COUNT=2'
  ],
  'attendees': [
    {'email': 'lpage@example.com'},
    {'email': 'sbrin@example.com'},
  ],
  'reminders': {
    'useDefault': false,
    'overrides': [
      {'method': 'email', 'minutes': 24 * 60},
      {'method': 'popup', 'minutes': 10},
    ],
  },
};

相关内容

  • 没有找到相关文章

最新更新