Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

400 Bad Request Inserting an event in Google Calendar

I am using the Google Calendar API and I am trying to send a request to the API for inserting an event but I'm getting an error.

This is the request that I am sending:

POST https://www.googleapis.com/calendar/v3/calendars/riteshmehandiratta%40gmail.com/events?key={YOUR_API_KEY}

Content-Type:  application/json
Authorization:  Bearer ya29.AHES6ZQwHy_3OYLmXtZpSa5PIwnBO3hqLWolMXpTYiFOEtjlEmbxNrYn
X-JavaScript-User-Agent:  Google APIs Explorer

{

 "end": {
  "date": "2/14/2007"
 },
 "start": {
  "date": "2/14/2007"
 },
 "kind": "calendar#event",
 "summary": "Hello World"
}

and the response I am getting is:

400 Bad Request

- Hide headers -

cache-control:  private, max-age=0
content-encoding:  gzip
content-length:  122
content-type:  application/json; charset=UTF-8
date:  Sat, 23 Mar 2013 17:36:22 GMT
expires:  Sat, 23 Mar 2013 17:36:22 GMT
server:  GSE

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

I am unable to figure out why I am getting a bad request error.

like image 837
Ritesh Mehandiratta Avatar asked Jan 20 '26 09:01

Ritesh Mehandiratta


1 Answers

From what i can tell your date format is wrong, the API docs indicate:

 The date, in the format "yyyy-mm-dd", if this is an all-day event. 

You might want to use the 'Try it' form at the bottom of this page to first make sure your requests are valid:

https://developers.google.com/google-apps/calendar/v3/reference/events/insert#try-it

Good luck!

like image 175
Rohan Avatar answered Jan 22 '26 21:01

Rohan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!