How to send a message in linkedin

My task is to split the post related to the page. I went through the documentation, but I could not figure out what to do. I have many days, and I did not get a clear idea.

Can anyone clearly explain how to share the link. I do not want to share the whole page, but only a specific message.

Here is the code I got from the network, but I have no idea what is going on in this code.

<html> <head> <script type="text/javascript" src="//platform.linkedin.com/in.js"> api_key: xxxxxxxxx authorize: true onLoad: onLinkedInLoad </script> <script type="text/javascript"> // Setup an event listener to make an API call once auth is complete function onLinkedInLoad() { IN.Event.on(IN, "auth", shareContent); } // Handle the successful return from the API call function onSuccess(data) { console.log(data); } // Handle an error response from the API call function onError(error) { console.log(error); } // Use the API call wrapper to share content on LinkedIn function shareContent() { // Build the JSON payload containing the content to be shared var payload = { Content-Type: application/json x-li-format: json "comment": "Check out developer.linkedin.com!", "content": { "title": "LinkedIn Developers Resources", "description": "Leverage LinkedIn APIs to maximize engagement", "submitted-url": "https://developer.linkedin.com", "submitted-image-url": "https://example.com/logo.png" }, "visibility": { "code": "anyone" } }; IN.API.Raw("/people/~/shares?format=json") .method("POST") .body(JSON.stringify(payload)) .result(onSuccess) .error(onError); } </script> </head> <body> <script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script> <script type="IN/Share"></script> </body> </html> 

Do I need any other files along with the codes?

I work in codeigniter.

Please, help.

Thanks in advance.

+6
source share
1 answer

I read your javascript code, it does what you really want, but I think you should do it in php or nodejs, for example, in backend languages.

To do this, as well as more, you need to use the Linked in REST API.
All REST APIs have the same architecture, first you need to authenticate your account, then send requests and receive answers (with the same session) and do what you want.

Edit: I found exactly what you want in here

0
source

All Articles