Created
June 7, 2016 12:18
-
-
Save rmgimenez/4ef823c4f29805fe7b7983a391995b1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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