Answer the question
In order to leave comments, you need to log in
How to take data from apache CloseableHttpClient response?
How to take data from response? For example, I want to take titel. How can I do it? What I get by my method on the screen.
public static void main(String[] args) throws IOException {
CloseableHttpClient httpclient = HttpClients.createDefault();
HttpGet httpget = new HttpGet("https://videocdn.tv/api/short?api_token=92nAbf1f&id=6089");
HttpResponse response = httpclient.execute(httpget);
Scanner sc = new Scanner(response.getEntity().getContent());
while(sc.hasNext()) {
System.out.println(sc.nextLine());
}
}
Answer the question
In order to leave comments, you need to log in
Good afternoon!
From the response, you can see that you are getting a JSON response. Next, you need to deserialize the JSON to the pojo.
There are various libs for this. You can take Jackson or GSON.
Here is a similar question:
https://stackoverflow.com/questions/6949329/how-de...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question