Update EventError : Invalid or mismatching start and end times.

2,164 views
Skip to first unread message

clark galgo

unread,
Feb 6, 2012, 4:10:02 AM2/6/12
to google-ca...@googlegroups.com
When I try to update event it gives me this error.

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "invalid",
    "message": "Invalid or mismatching start and end times."
   }
  ],
  "code": 400,
  "message": "Invalid or mismatching start and end times."
 }
}

What am I doing wrong?

Ray Baxter

unread,
Feb 6, 2012, 10:27:29 AM2/6/12
to google-ca...@googlegroups.com
Giving invalid or mismatching start and end times?

--
You received this message because you are subscribed to the Google Groups "Google Calendar API" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-calendar-api/-/OY7veDqpPSIJ.
To post to this group, send email to google-ca...@googlegroups.com.
To unsubscribe from this group, send email to google-calendar...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-calendar-api?hl=en.

clark galgo

unread,
Feb 6, 2012, 8:45:50 PM2/6/12
to google-ca...@googlegroups.com
I don't understand. I put valid start and end time, but still it doesn't work.. we'll in fact I dont really know what's the valid start time and whis invalid.. can you give me a example of valid start and end time. Thank you in advance

Bob Myers

unread,
Feb 6, 2012, 9:28:50 PM2/6/12
to Google Calendar API
This error, in turns out, could be due to ANYTHING. It seems that
dates are the first check run by the backend and if ANYTHING is wrong,
including missing payload (in my case it was due to using the "body"
keyword rather than "resource" in the JS v3 API to provide the POST
data), will cause this error. By the way, if you actually want anyone
to help you with this error, wake up and provide information such as
the API you are using, your code, what debugging you have done and the
results, etc. For your information, examples of correct date formats
are EVERYWHERE in the GC API docs.

clark galgo

unread,
Feb 6, 2012, 9:50:44 PM2/6/12
to google-ca...@googlegroups.com
I'm using calendar API v3 and use cURL in PHP with PUT request sending json data. I also have tried updating event using api explorer and it also give me the same error.

I found out that if I put "Content-type: application/json" on the header of my curl request ti gives me different error, the error is like this.

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "badRequest",
    "message": "Bad Request"
   }
  ],
  "code": 400,
  "message": "Bad Request"
 }
}

here's my code :

$query = {
  "kind": "calendar#event",
  "id": "eventId",
  "etag": "eventEtag",
  "status": "confirmed",
  "htmlLink": "https://www.google.com/calendar/event?eid=eventEid",
  "created": "2011-05-23T22:27:01Z",
  "updated": "2011-05-23T22:27:01Z",
  "summary": "Appointment at Somewhere",
  "location": "Somewhere",
  "creator": {
    "email": "userEmail"
  },
  "organizer": {
    "email": "userEmail",
    "displayName": "userDisplayName"
  },
  "start": {
    "dateTime": "2011-06-03T10:00:00.000-07:00",
    "timeZone": "America/Los_Angeles"
  },
  "end": {
    "dateTime": "2011-06-03T10:25:00.000-07:00",
    "timeZone": "America/Los_Angeles"
  },
  "iCalUID": "eventUID",
  "sequence": 0,
  "attendees": [
    {
      "email": "attendeeEmail",
      "displayName": "attendeeDisplayName",
      "responseStatus": "needsAction"
    },
    # ...
    {
      "email": "userEmail",
      "displayName": "userDisplayName",
      "responseStatus": "accepted",
      "organizer": true,
      "self": true
    }
  ],
  "guestsCanInviteOthers": false,
  "guestsCanSeeOtherGuests": false,
  "reminders": {
    "useDefault": true
  }
}

$ch = curl_init();
$url = "https://www.googleapis.com/calendar/v3/calendars/calendarId/events/eventId";

$header = "Content-type: application/json";
$putData = tmpfile()
fwrite($putData, $query);
fseek($putData, 0);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_BINARYTRANSFER, true);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_PUT, true);
curl_setopt($ch, CURLOPT_INFILE, $putData);
curl_setopt($ch, CURLOPT_INFILESIZE, strlen($query));
$output = curl_exec($ch);
echo $output;
fclose($putData);
curl_close($ch);

Ray Baxter

unread,
Feb 7, 2012, 3:55:34 AM2/7/12
to google-ca...@googlegroups.com
If you use the APIs Explorer or look at the developer's guide for Creating events you'll see that they do not use the same format for start and end times that you are using. They use:


  "start": {
   
"dateTime": "2011-06-03T10:00:00.000-07:00"
 
},

 
"end": {
   
"dateTime": "2011-06-03T10:25:00.000-07:00"
 
},

Ray

--
You received this message because you are subscribed to the Google Groups "Google Calendar API" group.
Reply all
Reply to author
Forward
0 new messages