Can't connect to Channels/Users API (java)

I’m trying to get the channels and users API for my channel but every time I try to retrieve it, It returns a FileNotFoundException / 404 error.
https://api.twitch.tv/kraken/streams/[user] is the only API that does work.

This is the function I use to do the request:

public static String getJson(String URL){
	StringBuilder result = new StringBuilder();
	HttpsURLConnection con;
	
	try {
		con = (HttpsURLConnection) new URL(URL).openConnection();
		con.setRequestMethod("GET");
		con.setDoOutput(true);
		con.setRequestProperty("Accept", "application/vnd.twitchtv.v3+json");
		con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
	        OutputStreamWriter out = new OutputStreamWriter(con.getOutputStream());
	        out.flush();
	    
	        InputStream in = new BufferedInputStream(con.getInputStream());
                BufferedReader reader = new BufferedReader(new InputStreamReader(in));
                String line;
                while ((line = reader.readLine()) != null) {
                    result.append(line);
                }    
	} 
        catch (Exception e) {
		e.printStackTrace();
	} 
	return result.toString();
}

Does anyone know how to fix this?

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