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.[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.setRequestProperty("Accept", "application/vnd.twitchtv.v3+json");
		con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
	        OutputStreamWriter out = new OutputStreamWriter(con.getOutputStream());
	        InputStream in = new BufferedInputStream(con.getInputStream());
                BufferedReader reader = new BufferedReader(new InputStreamReader(in));
                String line;
                while ((line = reader.readLine()) != null) {
        catch (Exception e) {
	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.