我在 LinkedIn 上分享时遇到困难。我试图通过 LinkedIn API V2 发布 LinkedIn 共享,每次发出发布请求时,我都会从服务器收到请求超时(状态 504)答案。这是我的代码:
myPost = {
'author': 'urn:li:person:' + this.uid,
'lifecycleState': 'PUBLISHED',
'specificContent': {
'com.linkedin.ugc.ShareContent': {
'shareCommentary': {
'text': 'Hello World! This is my first Share on LinkedIn!'
},
'shareMediaCategory': 'NONE'
}
},
'visibility': {
'com.linkedin.ugc.MemberNetworkVisibility': 'PUBLIC'
}
}
header = {
'Content-Type': 'application/json',
'X-Restli-Protocol-Version': '2.0.0',
'Authorization': 'Bearer ' + token
};
this.http.post('https://api.linkedin.com/v2/ugcPosts', myPost, header).then(res => {
alert(JSON.stringify(res));
})
.catch(err => {
alert(JSON.stringify(err));
});
Run Code Online (Sandbox Code Playgroud)
这是错误消息:
{
"message": "Request timed out",
"status": 504
} …Run Code Online (Sandbox Code Playgroud) linkedin-api ×1