Search code examples
apicoldfusionlinkedin-api

Working example Coldfusion and Linkedin API


Has anyone managed to get the LinkedIn API working from within a coldfusion application? There are some threads in the Linkedin Developer's community, but any actual working examples or complete code are missing.

In the end I'm looking for a solution to import LinkedIn profiles to our recruitment solution - and also fetch updated profiles regularly - ofcourse after the user gives us access to his/her profile.

Any help appreciated, especially with some kind of working setup (even if only basic)


Solution

  • Since ColdFusion can create and use Java objects, the easiest solution is to use a Java API to access LinkedIn. One option is linkedin-j.

    Update

    I haven't found any evidence of a CF-based wrapper so unfortunately you're going to have to figure this part out.

    You don't need to really know how Java works to use Java objects in ColdFusion; you just have to know what the classes are in the API in question and then create the necessary objects and then call the relevant functions. I assume linkedin-j offers some kind of .jar file. You need to add that to your classpath; there are plenty of resources on line on how to do this (if that link breaks, just search for coldfusion jar classpath). Then, figure out which object you need, create an instance of that object you need using CreateObject.

    The getting started page talks about a LinkedInApiClientFactory object. You'd create this in ColdFusion by doing something like

    <cfset factory = CreateObject('com.google.code.linkedinapi.client.LinkedInApiClient').newInstance(consumerKeyValue, consumerSecretValue)>
    <cfset client = factory.createLinkedInApiClient(accessTokenValue, tokenSecretValue)>
    

    At which point you can use all of the functions available to the LinkedInApiClient, such as getProfileByUrl.

    Use the documentation available at the linkedin-j site to find out about the functions you can call on the LinkedInApiClient, and work from there.