I am having difficulty getting a share on LinkedIn. I am trying to post a LinkedIn share via LinkedIn API V2 and every time I make the post request I get a request timed out (status 504) answer from the server. Here is my code :
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));
});
And here is the error message :
{
"message": "Request timed out",
"status": 504
}
It's an angular-ionic project and I use the native cordova-plugin-advanced-http to make my post request. I had no issue to sign in with LinkedIn, get my access token and retrieve data from LinkedIn using the same native plugin and the LinkedIn API V2.
On my LinkedIn developer account, to the usage & limits page, I can see the API call to create method.