Ofir
Ofir

Reputation: 324

Get main picture URL of LinkedIn user

When requesting Basic Profile Fields for a specific user we get back the following:

  1. picture-url, a URL for a square profile picture with a size of 100x100 pixels.

  2. picture-urls, a list containing URLs for the original uploaded picture.

What I need is the user's picture in square size and in a higher quality.

I know that the user's main picture (the one that is available on his/her profile page under https://www.linkedin.com/in/[user_id]/) is the size of 200x200 pixels, which is much better.

How can I access this picture URL through the API?

Remark: If I try to just generate this URL I get Access Denied error.

Upvotes: 6

Views: 36170

Answers (1)

Christos Lytras
Christos Lytras

Reputation: 37318

The LinkedIn API does not have any documented way to access the different sizes of the generated images. You can use picture-urls::(original) field to get the original uploaded picture URL and then scale it as you like. The original uploaded image can be even larger than 200x200 that the LinkedIn profile uses.

https://developer.linkedin.com/docs/fields/basic-profile

picture-urls::(original) A URL to the member's original unformatted profile picture. This image is usually larger than the picture-url value above.

API Call

GET: /v1/people/~:(id,first-name,last-name,picture-url,picture-urls::(original))

Result

{
    "firstName": "Christos",
    "id": "...",
    "lastName": "Litras",
    "pictureUrl": "https://media.licdn.com/dms/image/C5603AQHcTGe3GOQviw/profile-displayphoto-shrink_100_100/0?e=1528894800&v=beta&t=JzgIhDOm-xGxIEuQP1jy3sFHRAeN5pk5skHhXm9s3wM",
    "pictureUrls": {
        "_total": 1,
        "values": [
            "https://media.licdn.com/dms/image/C5600AQG-fzvmQVCLsg/profile-originalphoto-shrink_900_1200/0?e=1528894800&v=beta&t=TrtntJgtAHeolrPeteffiq_Ixg-JecaAvutQioy0c8A"
        ]
    }
}

Upvotes: 2

Related Questions