title: java.lang.RuntimeException: Failed : HTTP error code : 404
body: <pre><code>import java.io.BufferedReader;
  import java.io.BufferedWriter;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.OutputStream;
  import java.io.OutputStreamWriter;
  import java.io.UnsupportedEncodingException;
  import java.net.InetSocketAddress;
  import java.net.MalformedURLException;
  import java.net.Proxy;
  import java.net.URL;
  import java.net.URLEncoder;
  import java.util.ArrayList;
  import java.util.List;
  
  import javax.net.ssl.HttpsURLConnection;
  
  import org.apache.http.NameValuePair;
  import org.apache.http.message.BasicNameValuePair;
  
  public class NetClientGet {
  
      public static void main(String[] args) {
  
        try {
  
          URL url = new URL("https://demo.docusign.net/restapi/v2/login_information");
          Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxy.ops.tiaa-cref.org", 8080));
          HttpsURLConnection conn = (HttpsURLConnection) url.openConnection(proxy);
          conn.setRequestMethod("GET");
  
          conn.setRequestProperty("content-type", "application/json");
          conn.setRequestProperty("Username", "puviars@gmail.com");
          conn.setRequestProperty("Password", "*******");
          conn.setRequestProperty("IntegratorKey", "TIAC-e30cd896-cd8b-4cca-8551-86b8c51ea85a");
          //conn.setRequestProperty("X-DocuSign-Authentication","{\"Username\":\"puviars@gmail.com\",\"Password\":\"********\",\"IntegratorKey\":\"TIAC-e30cd896-cd8b-4cca-8551-86b8c51ea85a\"}");
  
          //String input = "{\"api_password\":\"false\",\"include_account_id_guid\":\"false\",\"login_settings\":\"none\"}";
  
          conn.setUseCaches(false);
          conn.setDoInput(true);
          conn.setDoOutput(true);
  
          List&lt;NameValuePair&gt; params = new ArrayList&lt;NameValuePair&gt;();
          params.add(new BasicNameValuePair("api_password", "true"));
          params.add(new BasicNameValuePair("include_account_id_guid", "false"));
          params.add(new BasicNameValuePair("login_settings", "all"));
  
          OutputStream os = conn.getOutputStream();
          BufferedWriter writer = new BufferedWriter(
                  new OutputStreamWriter(os, "UTF-8"));
          writer.write(getQuery(params));
          writer.flush();
          writer.close();
          os.close();
  
          //conn.setDoOutput(true);
          //OutputStream os = conn.getOutputStream();
          //os.write(input.getBytes());
          //os.flush();
  
  
          //conn.setRequestProperty("api_password","false");
         //conn.setRequestProperty("include_account_id_guid","false");
          //conn.setRequestProperty("login_settings","none");
  
      if (conn.getResponseCode() != 200) {
              throw new RuntimeException("Failed : HTTP error code : "
                      + conn.getResponseCode());
          }
  
          BufferedReader br = new BufferedReader(new InputStreamReader(
              (conn.getInputStream())));
  
          String output;
          System.out.println("Output from Server .... \n");
          while ((output = br.readLine()) != null) {
  
              System.out.println(output);
          }
  
          conn.disconnect();
  
        } catch (MalformedURLException e) {
  
          e.printStackTrace();
  
        } catch (IOException e) {
  
          e.printStackTrace();
  
        }
  
      }
  
      private static String getQuery(List&lt;NameValuePair&gt; params) throws UnsupportedEncodingException
      {
          StringBuilder result = new StringBuilder();
          boolean first = true;
  
          for (NameValuePair pair : params)
          {
              if (first)
                  first = false;
              else
                  result.append("&amp;");
  
              result.append(URLEncoder.encode(pair.getName(), "UTF-8"));
              result.append("=");
              result.append(URLEncoder.encode(pair.getValue(), "UTF-8"));
          }
  
          return result.toString();
      }
  
  }
  </code></pre>
  
  <p>// </p>
  
  <p>while invoking rest url via httpsurlconnection, the below code in eclispe IDE using run as java program.i am getting the below error:</p>
  
  <p>Exception in thread "main" java.lang.RuntimeException: Failed : HTTP error code : 404
      at NetClientGet.main(NetClientGet.java:71)</p>
  
  <p>Please help me to resolve it. This code is just to hit demo url to login &amp; fetch the details &amp; then i will proceed to send the pdf documents to esign it.But if am using their interactive website i could get the response in JSON.</p>
  
  <p>//</p>