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("https://api.twitch.tv/kraken/streams/?channel=" + channelID)
    connection = (HttpURLConnection) url.openConnection();
    connection.setRequestMethod("GET");
    connection.addRequestProperty("Accept", "application/vnd.twitchtv.v5+json");
    connection.addRequestProperty("Client-ID", clientID);

    connection.setUseCaches(false);
    connection.setDoInput(true);
    InputStream inputStream = connection.getInputStream();
    BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
    String line;
    StringBuilder response = new StringBuilder();
    while ((line = br.readLine()) != null) {
        response.append(line);
        response.append("\r");
    }
    br.close();
    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("java.net.useSystemProxies", "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.