问题
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"
}
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"
}
}
When I send the same request through Try this API its working fine. Please Help!!!
回答1:
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},
],
},
};
来源:https://stackoverflow.com/questions/46578486/parse-error-during-insert-event-in-google-calendar-api