Created
August 27, 2013 02:42
-
-
Save showsky/6349110 to your computer and use it in GitHub Desktop.
For Vincent
Nike API JAVA Version
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 java.io.BufferedReader; | |
import java.io.InputStreamReader; | |
import java.net.URL; | |
import java.net.URLConnection; | |
public class Nike { | |
public static void main(String[] args) throws Exception { | |
String baseURL = "https://api.nike.com/me/sport?access_token="; | |
String tok = ""; | |
StringBuffer response = new StringBuffer(); | |
URL url = new URL(baseURL + tok); | |
URLConnection conn = url.openConnection(); | |
conn.setRequestProperty("appid", "fuelband"); | |
conn.setRequestProperty("Accept", "application/json"); | |
BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream())); | |
String line = null; | |
while ((line = br.readLine()) != null) { | |
response.append(line); | |
} | |
System.out.println(response.toString()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment