I am trying get the url for facebook profile photo which appears in contact detail page.
I am able get the photoUrl of Contact by SOQL query:
select photourl from contact where id = 'contact Id'
response = /services/images/photo/contactId
If I use this in workbench REST Explores I am getting the proper response with facebook profile image url.
But how to do this Rest call in apex.
I tried :
public String getCalloutResponseContents(String url) {
// Instantiate a new http object
Http h = new Http();
// Instantiate a new HTTP request, specify the method (GET) as well as the endpoint
HttpRequest req = new HttpRequest();
req.setEndpoint(url);
req.setMethod('GET');
// Send the request, and return a response
HttpResponse res = h.send(req);
System.debug(res);
return res.getBody();
} but getting bad request error.