Skip to content

Instantly share code, notes, and snippets.

@rmgimenez
Created June 7, 2016 12:18
Show Gist options
  • Save rmgimenez/4ef823c4f29805fe7b7983a391995b1b to your computer and use it in GitHub Desktop.
Save rmgimenez/4ef823c4f29805fe7b7983a391995b1b to your computer and use it in GitHub Desktop.
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();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment