title: Reddit API for voting
body: <p>I'm able to login to reddit via the API with Java, but I can't get a vote to process. This was an attempt to do a reduced case just to get it to work. But all I get back is "User is required to do this"; any ideas?</p>
  
  <pre><code>String apiParams = "api_type=json&amp;id=c38ghjg&amp;dir=1&amp;uh=" + modHash;
  
  URL voteURL = new URL("http://www.reddit.com/api/vote");
  HttpURLConnection connection = (HttpURLConnection) voteURL.openConnection ();
  connection.setDoOutput (true);
  connection.setRequestMethod ("POST");
  connection.setUseCaches (false);
  connection.setRequestProperty ("Content-Type",
                              "application/x-www-form-urlencoded; charset=UTF-8" );
  connection.setRequestProperty("cookie", "reddit_session="+cookie);
  connection.setRequestProperty ("Content-Length",
                              String.valueOf( apiParams.length() ));
  DataOutputStream wr = new DataOutputStream( connection.getOutputStream() );
  wr.writeBytes( apiParams );
  wr.flush();
  wr.close();
  InputStream cis = connection.getInputStream();
  
  HashMap&lt;String, String&gt; parameters = new HashMap&lt;String,String&gt; ();
  
  if(cis != null){
      ObjectMapper mapper = new ObjectMapper ();
  
      TypeReference&lt;Map&lt;String, Object&gt;&gt;
      mapReference = new TypeReference&lt;Map&lt;String, Object&gt;&gt; () { };
  
      Map&lt;String, Object&gt; resultJSON = mapper.readValue (cis, mapReference);
  
      Map&lt;String, Object&gt; json = (Map&lt;String, Object&gt;) resultJSON.get ("json");
      Map&lt;String, Object&gt; data = (Map&lt;String,Object&gt;) json.get ("data");
      System.out.println(json);
  }
  </code></pre>