user11157722
user11157722

Reputation:

how to get Linkedin person id for V2 api?

I am trying to post on my LinkedIn profile through Linkedin V2 API. It keeps returning an error

Request Error: com.linkedin.publishing.util.common.ResponseException: Writers of type person are not authorized to modify UserGeneratedContent..

maybe this is happening because I didn't send my LinkedIn person id.

$author = array(
            'author' => 'urn:li:person:XXXXXXXX',
        );

How can i find my linkedin profile's Person id?

Upvotes: 5

Views: 6402

Answers (1)

Matteo
Matteo

Reputation: 39410

You can use the Profile API to Retrieve Current Member's Profile. In the Section about the Person ID:

The id returned in the response is the unique identifier of the user

You can also use fields projection in order to retrieve only the id field, as example:

curl -H "Authorization: Bearer <token>" \
"https://api.linkedin.com/v2/me?projection=(id)"

will return:

{
  "id": "yrZCpj2Z12"
}

Upvotes: 3

Related Questions