Retrieve LinkedIn Profile Picture Using JavaScript with REST API
<p>I am currently implementing a LinkedIn authorization and sign in feature on my web application and am using the linkedin JavaScript Developer sample code:</p>

<pre><code>&lt;script type="text/javascript" src="//platform.linkedin.com/in.js"&gt;
    api_key: YOUR_API_KEY_HERE
    authorize: true
    onLoad: onLinkedInLoad
&lt;/script&gt;

&lt;script type="text/javascript"&gt;

    // Setup an event listener to make an API call once auth is complete
    function onLinkedInLoad() {
        IN.Event.on(IN, "auth", getProfileData);
    }

    // Handle the successful return from the API call
    function onSuccess(data) {
        console.log(data);
    }

    // Handle an error response from the API call
    function onError(error) {
        console.log(error);
    }

    // Use the API call wrapper to request the member's basic profile data
    function getProfileData() {
        IN.API.Raw("/people/~").result(onSuccess).error(onError);
    }

&lt;/script&gt;
</code></pre>

<p>This segment of code returns the first name, last name, headline (description of job title), and id using the raw() method within the getProfileData() method.</p>

<p>I am now trying to get the users profile picture as well to use on my application and cannot figure out how to do so with the code I already have.  The linkedIn developer site gives the following example of how to do so with the REST api: </p>

<pre><code>https://api.linkedin.com/v1/people/~:(picture-url)?format=json
</code></pre>

<p>I have never used the REST API so I cannot figure out how to implement this code into the existing segment that I have.  How could i make a request to this REST API code with my existing JS code so that the prorgam can get both text data and the users image?</p>