如何在linkedin中使用javascript发布内容
我必须使用javascript登录linkedin并发布内容。 使用下面的代码,我已经成功登录,当我发布了我在firebug中得到下面的错误 网络错误:403禁止- 我需要在墙上张贴内容 下面代码中的问题是什么如何在linkedin中使用javascript发布内容,javascript,linkedin,Javascript,Linkedin,我必须使用javascript登录linkedin并发布内容。 使用下面的代码,我已经成功登录,当我发布了我在firebug中得到下面的错误 网络错误:403禁止- 我需要在墙上张贴内容 下面代码中的问题是什么 <script type="text/javascript" src="http://platform.linkedin.com/in.js"> api_key: xxxxxxx onLoad: onLinkedInAuth scope: r_net
<script type="text/javascript" src="http://platform.linkedin.com/in.js">
api_key: xxxxxxx
onLoad: onLinkedInAuth
scope: r_network w_messages
authorize: true
</script>
<script type="text/javascript">
function onLinkedInLoad() {
IN.Event.on(IN, "auth", onLinkedInAuth);
}
function onLinkedInAuth() {
var div = document.getElementById("sendMessageForm");
div.innerHTML = '<h2>Send a Message To Yourself</h2>';
div.innerHTML += '<form action="javascript:SendMessage();">' +
'<input id="message" size="30" value="You are awesome!" type="text">' +
'<input type="submit" value="Send Message!" /></form>';
}
function SendMessage(keywords) {
var message = document.getElementById('message').value;
var BODY = {
"recipients": {
"values": [{
"person": {
"_path": "/people/~",
}
}]
},
"subject": "JSON POST from JSAPI",
"body": message
}
IN.API.Raw("/people/~/mailbox")
.method("POST")
.body(JSON.stringify(BODY))
.result(displayMessageSent)
.error(function error(e) { alert ("No dice") });
}
function displayMessageSent() {
var div = document.getElementById("sendMessageResult");
div.innerHTML += "Yay!";
}
</script>
</head>
<body>
<script type="IN/Login"></script>
<div id="sendMessageForm"></div>
<div id="sendMessageResult"></div>
我使用下面的javascript代码发布了linkedin
IN.API.Raw("/people/~/current-status") // Update (PUT) the status
.method("PUT")
.body(JSON.stringify("Test Message"))
.result( function(result) { document.getElementById("statusDiv").innerHTML = "Status updated"; } )
.error( function(error) { /* do nothing */ } );
此api不在墙上发布。它是发送消息api。