Skip to content

Instantly share code, notes, and snippets.

@slojo404
Forked from hjr3/linkedin-api-invite
Created May 29, 2012 01:22
Show Gist options
  • Save slojo404/2822038 to your computer and use it in GitHub Desktop.
Save slojo404/2822038 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 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