AYONDIP JANA
AYONDIP JANA

Reputation: 81

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

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.

Upvotes: 7

Views: 9555

Answers (5)

Ekta Tandel
Ekta Tandel

Reputation: 1

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

Upvotes: 0

yabood
yabood

Reputation: 171

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.

Upvotes: 4

Karan Jain
Karan Jain

Reputation: 1

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

Upvotes: 0

tom
tom

Reputation: 1

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"
}

Upvotes: 0

maxicano447
maxicano447

Reputation: 113

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

Upvotes: 9

Related Questions