Twtich API returning 400 on linux but working on windows

I am making a request to twitch api with the following code

    URL url = new URL("" + channelID)
    connection = (HttpURLConnection) url.openConnection();
    connection.addRequestProperty("Accept", "application/vnd.twitchtv.v5+json");
    connection.addRequestProperty("Client-ID", clientID);

    InputStream inputStream = connection.getInputStream();
    BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
    String line;
    StringBuilder response = new StringBuilder();
    while ((line = br.readLine()) != null) {
    return response.toString();

This gets the correct response on windows, however when i run it on my Raspberry PI it gets a 400 response. I found a similar question on Stack Overflow i tried to set the proxy settings with this code

    System.setProperty("", "true");

However this failed to fix this request, any idea what is causing this?

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.