bannerColor WARNING_YELLOW templateName stackForums

Javascript Invitation request by id

1 post / 0 new
Jeff Shoemaker's picture
Joined: 2011-06-13
Nov 5, 2012
Javascript Invitation request by id

I can't seem to send a request by member ID, and can't find solution in the docs. I'm using the below function and getting this error:

{
"errorCode": 0,
"message": "Missing authorization token, e.g: <person path='/people/{id}[*{auth_tiken_name*auth_token_value}]' or <authorization>... check doc",
"requestId": "R0GZAA9XIF",
"status": 400,
"timestamp": 1352137558097
}

function invite(id) {
var url = '/people/~/mailbox',
body = {
recipients: {
values: [{
person: {
_path: '/people/'+id
}
}]
},
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.toSource());
})
.error(function (error) {
console.log('error: '+error.toSource());
});
}

Any help would be appreciated. Thank you.