A referral link such as, https://www.gitshowcase.com/invitation/1951fdg, the Fetched URL, is replaced with https://www.gitshowcase.com/, the Canonical URL, as tested with Post Inspector, hence it becomes necessary to post via the LinkedIn REST API
Create an application on LinkedIn
1) Default Application Permissions:
- r_liteprofile
- rw_company_admin
- w_member_social
2) Under OAuth 2.0, Authorized Redirect URLs, add:
3) Copy the Authentication Keys:
- Client ID
- Client Secret
Install PostMan
1) Open PostMan and import file:
- linkedin.postman_collection.json
2) Edit collection LinkedIn:
- Click Authorization
- Click Get New Access Token
3) Fill the following:
-
Token Name : {provide a token name}
-
Grant Type : Authorization Code
-
Callback URL: https://www.getpostman.com/oauth2/callback
-
Access Token URL : https://www.linkedin.com/oauth/v2/accessToken
-
Client ID : {provide the copied Client ID}
-
Client Secret : {provide the copied Client Secret}
-
Scope : r_liteprofile rw_company_admin w_member_social
-
State : {provide a unique string value of your choice that is hard to guess}
-
Client Authentication: Send client credentials in body
4) Click on Request Token
5) You will be redirected to LinkedIn page
- Enter your credentials and allow access
6) Click on Use Token
7) Click on Update
1) Choose Retrieve author
2) Copy value for key "id"
1) Choose Create an Article or URL Share
2) Edit Body
For submitting a fully described share via POST:
{
"author": "urn:li:person:{{person_id}}",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"shareCommentary": {
"text": ""
},
"shareMediaCategory": "ARTICLE",
"media": [
{
"status": "READY",
"description": {
"text": ""
},
"originalUrl": "",
"title": {
"text": ""
}
}
]
}
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "CONNECTIONS"
}
}
3) Replace {{person_id}} with Person URN (paste previously copied value)
4) com.linkedin.ugc. MemberNetworkVisibility can be:
- CONNECTIONS - Represents 1st degree network of owner.
- PUBLIC - Anyone can view this.
- LOGGED_IN - Viewable by logged in members only.
5) Click on Send
@rajurh - why do we require - linkedin.postman_collection.json? Do we need to use it when we go to apex class? if yes how to use it over there.