Return request Https 403

When I make a request: " https://www.btcturk.com/api/orderbook " through a browser or curl, I get a response as expected.

When I make the same request through jersey or java libraries such as HttpsURLConnection, I get a 403 forbidden answer.

I can use the same methods for requests to any other URLs running under https. An example method can be found below:

public static RestResponse getRestResponse(String url)
{   
    String jsonString;
    try
    {
        Client client = Client.create();

        WebResource webResource = client.resource(url);

        ClientResponse response = webResource.accept("application/json")
                .get(ClientResponse.class);

        if (response.getStatus() != 200) {

            return RestResponse.createUnsuccessfulResponse(response.getStatusInfo().getReasonPhrase());
        }

        jsonString = response.getEntity(String.class);
    }
    catch(Exception e)
    {
        return RestResponse.createUnsuccessfulResponse(e);
    }

    return RestResponse.createSuccessfulResponse(jsonString);
}

The above code is just an idea. All this can be found at: https://github.com/cgunduz/btcenter/tree/master/src/main/java/com/cemgunduz/web

My knowledge of the network is very limited, so any directions to where I should start would be useful. Greetings.

+4
1

, . / . : HTTPS REST Java

0

All Articles