在Google Calendar API中的插入事件期间解析错误 [英] Parse Error during insert event in google calendar api

查看:66
本文介绍了在Google Calendar API中的插入事件期间解析错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下面有一个json对象,并将其作为urlParameter传递

I've a json object below and passed it as 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 .但是我得到的错误是

I've also set the Content-Type as application/json. But I get the error as

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

当我通过尝试使用此API 可以正常工作.请帮忙!!!

When I send the same request through Try this API its working fine. Please Help!!!

推荐答案

如果要在实际编码中使用,请使用"撇号"而不是"双引号",如 Events.insert示例:

If you're going to do that in actual coding, use 'apostrophes' and not "double quotes" like what's indicated in the Events.insert sample :

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},
    ],
  },
};

这篇关于在Google Calendar API中的插入事件期间解析错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆