lundi 30 mars 2015

LinkedIn email retrieval using Spring RestTemplate

I'm trying to retrieve email id using the below code. I could retrieve firstname, lastname, title successfully without any issues using below code.



<code>
import org.springframework.web.client.RestTemplate;
RestTemplate myRestTemplate = new RestTemplate();;
result = myRestTemplate.getForObject("http://ift.tt/1xQmKH8"+accessToken+"&scope=r_emailaddress", String.class);


However, when i try to retrieve email id using the below code, I'm getting empty JSON as response. However, if I use the same constructed URL in LinkedIn API, I'm able to get email id in Rest API console. What is the mistake am doing?



<code>
String url = "http://ift.tt/1BYm8dp"+accessToken;
result = myRestTemplate.getForObject(url , String.class);


Note: I have established the connection successfully with LinkedIn. I'm trying to get email id of the logged in user.


Can someone help me?


Aucun commentaire:

Enregistrer un commentaire