Search code examples
androidlinkedin-apiaccess-token

LinkedIn v1 to v2 API migration


As per LinkedIn announcement, we need to migrate to version 2.0 of our APIs and OAuth 2.0 so as per release document I have change my GETrequest url from

 https://api.linkedin.com/v1/people/~:(first-name,last-name,email-address,skills,educations,positions,location,phone-numbers)?requestToken?scope=rw_nus+r_fullprofile&format=json&oauth2_access_token= 

to

https://api.linkedin.com/v2/me/~:(first-name,last-name,email-address,skills,educations,positions,location,phone-numbers)?requestToken?scope=rw_nus+r_fullprofile&format=json&oauth2_access_token= 

And I'm getting the below response:

{
    "serviceErrorCode": 0,
    "message": "Resource me does not exist",
    "status": 404
}

Please help me out, what is wrong from my side? What changes need to be done?


Solution

  • There's more to simply changing the v1 to v2 and people to me in the URL.

    To request specific fields, you pass in ?projection= instead of ~: for example:

    https://api.linkedin.com/v2/me?projection=(id,firstName,lastName)
    

    Also keep in mind that fields have changed in v2. By default, you will only have access to lite profile fields, unless you're part of LinkedIn Marketing Partners program.