-
-
Save slojo404/2822038 to your computer and use it in GitHub Desktop.
Simple example of using the LinkedIn JavaScript SDK to send an invite
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script> | |
function invite() { | |
var url = '/people/~/mailbox', | |
body = { | |
recipients: { | |
values: [{ | |
person: { | |
_path: '/people/[email protected]', | |
'first-name':'Andrew', | |
'last-name':'User' | |
} | |
}] | |
}, | |
subject: 'Invitation to connect.', | |
body: 'Say yes!', | |
'item-content':{ | |
'invitation-request':{ | |
'connect-type':'friend' | |
} | |
} | |
}; | |
IN.API.Raw() | |
.url(url) | |
.method("POST") | |
.body(JSON.stringify(body)) | |
.result(function (result) { | |
console.log(result); | |
}) | |
.error(function (error) { | |
console.log(error); | |
}); | |
} | |
</script> | |
<script type="text/javascript" src="http://platform.linkedin.com/in.js"> | |
api_key: secret | |
onLoad: invite | |
authorize: true | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment