Last active
February 27, 2019 05:27
-
-
Save matthewjackowski/f8bb400c30e7a81939bd38a0407f46a3 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
import javax.net.ssl.HttpsURLConnection; | |
import java.io.BufferedReader; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.net.URL; | |
public class Main | |
{ | |
public static void main(String[] args) { | |
try{ | |
String httpsURL = "https://api-sandbox.cloudwords.com/1.21/user/current.json"; | |
URL myUrl = new URL(httpsURL); | |
HttpsURLConnection conn = (HttpsURLConnection)myUrl.openConnection(); | |
conn.setRequestProperty ("Authorization", "UserToken <Venkat put your token here>"); | |
InputStream is = conn.getInputStream(); | |
InputStreamReader isr = new InputStreamReader(is); | |
BufferedReader br = new BufferedReader(isr); | |
String inputLine; | |
while ((inputLine = br.readLine()) != null) { | |
System.out.println(inputLine); | |
} | |
br.close(); | |
}catch(Exception e){ | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment