title: Create a new Event in Google Calendar using a Post Request
body: <p>I'm trying to create a new event in Google Calendar using a POST Request but I always get a 400 error.</p>
  
  <p>So far I have this:</p>
  
  <pre><code>String url = "https://www.googleapis.com/calendar/v3/calendars/"+ calendarID + "/events?access_token=" + token;
  String data = "{\n-\"end\":{\n\"dateTime\": \"" + day + "T" + end +":00.000Z\"\n},\n" +
                          "-\"start\": {\n \"dateTime\": \"" + day + "T" + begin + ":00.000Z\"\n},\n" +
                          "\"description\": \"" + description + "\",\n" +
                          "\"location\": \"" + location + "\",\n" +
                          "\"summary\": \"" + title +"\"\n}";
  
  
  
  System.out.println(data);
  
  URL u = new URL(url);
  HttpURLConnection connection = (HttpURLConnection) u.openConnection();           
  connection.setDoOutput(true);
  connection.setDoInput(true);
  connection.setInstanceFollowRedirects(false); 
  connection.setRequestMethod("POST"); 
  String a = connection.getRequestMethod();
  connection.setRequestProperty("Content-Type", "application/json"); 
  connection.setRequestProperty("Accept-Charset", "utf-8");
  connection.setRequestProperty("Authorization", "OAuth" + token); 
  connection.setUseCaches(false);
  DataOutputStream wr = new DataOutputStream(connection.getOutputStream ());
  wr.writeBytes(data);
  wr.flush();
  
  // Get the response
  BufferedReader rd = new BufferedReader(new InputStreamReader(connection.getInputStream()));
      String line;
  while ((line = rd.readLine()) != null) {
     System.out.println(line);
  }
  wr.close();
  rd.close();
  </code></pre>
  
  <p>But when I create the BufferedReader to read my response I get a 400 error. What's wrong?</p>
  
  <p>Thanks in advance!</p>