Java get latest GitHub release
<p>I had tried to acess to GitHub via Java to get the latest release of a repository and I had found <a href="https://developer.github.com/v3/repos/releases/#get-the-latest-release" rel="nofollow">this</a> and I tried to use it with this code:</p>

<pre><code>    String url = "https://github.com/:owner/:repo/releases/latest";

    try {
        CloseableHttpClient httpClient = HttpClientBuilder.create().build();
        HttpGet request = new HttpGet(url);
        request.addHeader("content-type", "application/json");
        HttpResponse result = httpClient.execute(request);
        String json = EntityUtils.toString(result.getEntity(), "UTF-8");

        System.out.println(json);
    } catch (IOException ex) {
    }
</code></pre>

<p>and the only thing I get as response is the HTML code of the website but I want the json response like you can see in the exaple response <a href="https://developer.github.com/v3/repos/releases/#get-the-latest-release" rel="nofollow">here</a>.</p>