Do note that, for this example, you need to have 'rw_nus' scope because it is required to retrieve and post updates to LinkedIn as authenticated user. So make sure you have checked the relevant box against ‘rw_nus’.
A LinkedIn Share contains following elements:
Comment
Content – Title
Content – URL
Content – Description
Content – Image URL
Visibility
However, if your application can't provide all the metadata, LinkedIn will attempt to fetch the missing content for you. So we will only provide following and rest will be handled by LinkedIn itself:
Comment – against the content you want to share
For example: “H-1B Work Visa USA - Everything you need to know - Info, Tips, Guides, Stats, News, Updates, Recommendations, Community, Jobs and much more!”
Here’s the code and inline explanation of what it does:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Once your program ran successfully, you will see a response on your console, similar to following:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You can use the update key to request the XML or JSON representation of the newly created share. This can be achieved by making a GET call to http://www.linkedin-ei.com/v1/people/~/network/updates/key={update_key} (setting {update_key} to the value you received in the previous response)
Alternatively, you can choose to to use the update url to redirect the user to the newly created share. This URL serves as a direct link to the posted share on LinkedIn.com so they can view the share in the browser.
No comments:
Post a Comment