Retorna json de um album do site imgur


public static String getAlbum(String idAlbum) throws MalformedURLException, IOException{
        
        String CLIENT_ID = "";
        String Client_Secret = ""; 

        String YOUR_USERNAME = " "; // enter your imgur username
        String YOUR_REQUEST_URL = "https://api.imgur.com/3/album/Y93oF";

        URL imgURL = new URL(YOUR_REQUEST_URL);
        HttpURLConnection conn = (HttpURLConnection) imgURL.openConnection();
        conn.setRequestMethod("GET");
        conn.setRequestProperty("Authorization", "Client-ID " + CLIENT_ID);

        BufferedReader bin = null;
        bin = new BufferedReader(new InputStreamReader(conn.getInputStream()));

        //below will print out bin
        String line;
        while ((line = bin.readLine()) != null)
            System.out.println(line);
        bin.close();

        return bin.toString();
    }

http://hilite.me/

Nenhum comentário:

Postar um comentário