/** * Get user name from LinkedIn, with the token provided. * @param token LinkedIn access token * @return The user found in LinkedIn * @throws java.io.IOException If fails */ private Identity fetch(final String token) throws IOException { final URI uri = UriBuilder // @checkstyle LineLength (1 line) .fromUri("https://api.linkedin.com/v1/people/~:(id,first-name,last-name,picture-url)?format=json") .queryParam("oauth2_access_token", "{token}") .build(token); return this.parse( new JdkRequest(uri) .header(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON) .fetch().as(RestResponse.class) .assertStatus(HttpURLConnection.HTTP_OK) .as(JsonResponse.class).json().readObject() ); }