Created
March 28, 2015 23:39
-
-
Save msrivastav13/37bf82973d413bf80a2c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class LinkedInCrtl{ | |
public LinkedInParser lwrapper{get;set;} | |
public LinkedInCrtl(){ | |
lwrapper=new LinkedInParser(); | |
fetchLinkedInDetails(); | |
} | |
private void fetchLinkedInDetails(){ | |
HttpRequest req = new HttpRequest(); | |
req.setheader('accept','application/json'); | |
req.setEndpoint('callout:Linkedin/people/~:(id,num-connections,picture-url,location,Summary,email-address,publications,languages,skills,certifications)?format=json'); | |
req.setMethod('GET'); | |
Http http = new Http(); | |
try{ | |
httpResponse res = http.send(req); | |
string responsestr=res.getBody(); | |
System.debug(res.getBody()); | |
responsestr=responsestr.replace('_total','total'); | |
lwrapper=(LinkedInParser)System.JSON.deserialize(responsestr, LinkedInParser.class); | |
}catch(exception e){ | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<apex:page controller="LinkedInCrtl" sidebar="false" showHeader="false" > | |
<p>Summary</p> | |
<p> | |
<apex:outputText value="{!SUBSTITUTE(JSENCODE(lwrapper.summary), '\\n', '<br/>')}" escape="false"/> | |
</p> | |
<apex:pageblock mode="maindetail" > | |
<apex:pageblockSection > | |
<apex:pageBlockTable value="{!lwrapper.skills.values}" var="skills" title="Certifications"> | |
<apex:column > | |
<apex:facet name="header">Skills</apex:facet> | |
{!skills.skill.name} | |
</apex:column> | |
</apex:pageBlockTable> | |
<apex:pageBlockTable value="{!lwrapper.certifications.values}" var="certs" title="Certifications"> | |
<apex:column > | |
<apex:facet name="header">Certifications</apex:facet> | |
{!certs.name} | |
</apex:column> | |
</apex:pageBlockTable> | |
</apex:pageblockSection> | |
</apex:pageblock> | |
</apex:page> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment