How to get other member's profile details from linkedin api
Asked Answered
M

5

6

I am trying to fetch users details from linkedIn api. After generating accesstoken I can get my details from linkedIn api but I want to get other members details. How to get this work? please help me.

I have tried the solutions according to the documentation. As per the documentation we have to sent a get request to the GET https://api.linkedin.com/rest/people/(id:{person ID}) to Retrieve Other Member's Profile. When I am sending the get request it is showing me

data: {
      code: 'VERSION_MISSING',
      message: 'A version must be present. Please specify a version by adding the LinkedIn-Version header.'
    }

this error. after searching the documentation I found that there is a note saying

in order to make the sample calls above succeed, you must include X-RestLi-Protocol-Version:2.0.0 in your request header.

I have added that to and still getting the error.

Motet answered 3/8, 2022 at 13:39 Comment(0)
R
9

I experienced the same issue. After some browsing this works for me:

Use https://api.linkedin.com/v2/me instead of https://api.linkedin.com/rest/me

Roer answered 20/8, 2022 at 20:45 Comment(1)
As the Linkedin docs say, in the end of Feb 2023, the APIs base path will be completely moved from "v2" to "rest". That means, using the old path will not help us anymore.Steed
M
4

You need to pass the version number like this: LinkedIn-Version: 202210. It worked for me without changing /rest to /v2. More info here: Introducing API Versioning and New Content APIs.

Marci answered 19/11, 2022 at 5:5 Comment(0)
G
0

I had the same problem.

As the error says, I tried using LinkedIn-Version as the header key and got:

{
    "code": "INVALID_VERSION",
    "message": "API versions should have date format as YYYYMM or YYYYMM.RR where RR is the revision"
}

With the header value being: 2.0.0

Request example picture

So I tried sending as value: 202201.01 ==> YYYY=2022, MM=01, RR=01

  • YYYY: year
  • MM: month
  • RR: revision

Request with new value example picture

Obtaining:

{
    "code": "NONEXISTENT_VERSION",
    "message": "Requested version 20220101 is not active"
}

Trying some different dates and revision codes, I got to value = 202204.01 that gave me:

{
"serviceErrorCode": 100,
"code": "ACCESS_DENIED",
"message": "Not enough permissions to access: me.GET.20220401"
}
Germin answered 4/8, 2022 at 15:23 Comment(1)
To Reviewers: "Still no answer to the question, and you have the same problem? Help us find a solution by researching the problem, then contribute the results of your research and anything additional you’ve tried as a partial answer. That way, even if we can’t figure it out, the next person has more to go on." (from How do I write a good answer?).Bunsen
M
0

I'm also facing the same issue but you can use this https://api.linkedin.com/v2/me and it will work

Mirabel answered 8/9, 2022 at 14:21 Comment(1)
This has already been suggested in another answer.Involucrum
H
0

This version worked for me: 202204.01

Then I got: "code": "EMPTY_ACCESS_TOKEN", "message": "Empty oauth2 access token"

Which I think can be fixed by getting the access token by implementing the 3-legged OAuth. I have successfully implemented that for getting someone's profile but I am doing this for getting org info

Homeland answered 7/2, 2023 at 19:15 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.