我已经创建了一个应用并进行了验证。
我已经获取了access_token和linkedin_id。
我设法在linkedin上发布了帖子。
分享后,我会收到此消息 stdClass对象([id] => urn:li:share:6555444310316195840)
json看起来像这样:
$body_json='
{
"author": "urn:li:person:'.$linkedin_id.'",
"lifecycleState": "PUBLISHED",
"specificContent": {
"com.linkedin.ugc.ShareContent": {
"shareCommentary": {
"text": "Share some url!"
},
"shareMediaCategory": "ARTICLE",
"media": [
{
"status": "READY",
"description": {
"text": "NEWS."
},
"originalUrl": "https://news.test.ce",
"title": {
"text": "TEST"
}
}
]
}
},
"visibility": {
"com.linkedin.ugc.MemberNetworkVisibility": "CONNECTIONS"
}
}';
代码是:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://api.linkedin.com/v2/ugcPosts");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json',
"x-li-format" => "json",
'Authorization: Bearer '.$access_token));
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,$body_json);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
$result = curl_exec($ch);
$result_decoded = json_decode($result);
如果我转到通知,就会看到该帖子,但是在我公司的页面上看不到。
如何在我的公司页面中显示该帖子?
我试图用
替换作者json_body"author": "urn:li:organization:'.$linkedin_id.'",
这个案例的linkedin_id是公司的ID(以前我用自己的Linkedin_id)
但是我得到这个错误:
stdClass Object ( [serviceErrorCode] => 100 [message] => Field Value validation failed in REQUEST_BODY: Data Processing Exception while processing fields [/author] [status] => 403 )
我都曾尝试致电GET / organizations / org_id 但我收到此错误
{"serviceErrorCode":100,"message":"Not enough permissions to access: GET /organizations/org_id","status":403}
但是我是公司的管理员,我可以访问管理员页面...
如何在自己的公司页面上分享?