Skip to content

Instantly share code, notes, and snippets.

@matthewjackowski
Last active February 27, 2019 05:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matthewjackowski/f8bb400c30e7a81939bd38a0407f46a3 to your computer and use it in GitHub Desktop.
Save matthewjackowski/f8bb400c30e7a81939bd38a0407f46a3 to your computer and use it in GitHub Desktop.
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