Get main picture URL of LinkedIn user
Asked Answered
S

1

6

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.

Stidham answered 9/4, 2018 at 20:12 Comment(4)
It doesn't appear that the LinkedIn API supports any other formats. You'll probably need to use the original quality version provided and crop/resize it yourself.Wallache
Thanks John Ellmore, but that's a solution I thought of before. It seems so far that the answer is just no, it's not possible...Stidham
So the answer to this question is that - No you can not access the high resolution picture URL using LinkedIn's API ?Embolden
Rann Lifshitz Please see my last reply to Christos Lytras.Stidham
D
2

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"
        ]
    }
}
Doehne answered 14/4, 2018 at 12:15 Comment(6)
Thanks Christos Lytras, but that's a solution I thought of before. It seems so far that the answer is just no, it's not possible...Stidham
What's far? You get the URL with the original uploaded image that you can then downscale as you like, even with CSS or with some image rendering functions.Doehne
What I meant is that, so far/currently, it seems that there's no way to access the URL to "the user's picture in square size and in a higher quality", which is provided on the user' profile page, through the API. As for working with the original image, this was a solution which my team and I already discussed about (using cropping or CSS), but we prefer not to do so as this require some server-side work (doing crop) or client-side work (doing CSS, which, unfortunately, means for us, changing the CSS in a lot of places) instead of just fetching a different URL.Stidham
@Stidham you can create a simple server script (in PHP it's no more that 5-7 lines of code) that crops the image and then use that scripts URL to replace the image URL. The LinkedIn API does not have any documented way to access the different sizes of the generated images.Doehne
Christos Lytras Please add this last sentence of yours ("The LinkedIn API does not have...") to your original answer and I'll mark it as an answer.Stidham
@Stidham just edited my answer and added that sentence.Doehne

© 2022 - 2024 — McMap. All rights reserved.