parent
8fdeefb2ec
commit
9950056600
@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<script type="text/javascript" src="//platform.linkedin.com/in.js">
|
||||
api_key: IDA7qjMAuwYgRFCa
|
||||
authorize: false
|
||||
onLoad: onLinkedInLoad
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<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 = {
|
||||
"comment": "Check out developer.linkedin.com! http://linkd.in/1FC2PyG",
|
||||
"visibility": {
|
||||
"code": "anyone"
|
||||
}
|
||||
};
|
||||
|
||||
IN.API.Raw("/people/~/shares?format=json")
|
||||
.method("POST")
|
||||
.body(JSON.stringify(payload))
|
||||
.result(onSuccess)
|
||||
.error(onError);
|
||||
}
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in new issue