Skip to content

Instantly share code, notes, and snippets.

@hjr3
Created November 22, 2011 16:11
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save hjr3/1386030 to your computer and use it in GitHub Desktop.
Save hjr3/1386030 to your computer and use it in GitHub Desktop.
Simple example of using the LinkedIn JavaScript SDK to send an invite
<!DOCTYPE html>
<html>
<head>
<script>
function invite() {
var url = '/people/~/mailbox',
body = {
recipients: {
values: [{
person: {
_path: '/people/email=a_user@domain.com',
'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