public void getToken(String userID) throws URISyntaxException, IOException {
URIBuilder userBuild = new URIBuilder("https://api/token");
HttpPost post = new HttpPost(userBuild.build());
printPost(post);
}
public void printPost(HttpPost post) throws IOException {
HttpResponse response = client.execute(post);
BufferedReader rd = new BufferedReader(new InputStreamReader(
response.getEntity().getContent()));
String line;
while ((line = rd.readLine()) != null) {
System.out.println(line);
}
}
So, what I want to achieve is that I would like to save the "token" as a variable.
For example, when I run the method, "getToken()", it prints out like: {"token": "1234567" } on the console.
However, how sould I save that "1234567"? Is it related to something like getHeaders()?
Thanks in advance!