我有LinkedIn应用(从这里创建https://www.linkedin.com/developer/apps),其范围为 r_basicprofile,r_emailaddress,rw_company_admin,w_share
成功完成身份验证过程后,我从linkedin API获取访问令牌,并且正在努力获取经过身份验证的用户信息。
但是当我尝试使用 Rich Media共享 API时,它对我不起作用 我收到了以下错误
{ "serviceErrorCode":100, "message":"Not enough permissions to access media resource", "status":403 }
这是请求代码示例
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://api.linkedin.com/media/upload",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "------
WebKitFormBoundary7MA4YWxkTrZu0gW\r\nContent-Disposition: form-
data; name=\"source\"; filename=\"iphone5.jpeg\"\r\nContent-Type:
image/jpeg\r\n[**image_binary_data**]\r\n\r\n------WebKitFormBoundary7MA4YWxkTrZu0gW--",
CURLOPT_HTTPHEADER => array(
"authorization: Bearer [**accesstoken**]",
"cache-control: no-cache",
"content-type: multipart/form-data; boundary=----
WebKitFormBoundary7MA4YWxkTrZu0gW"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
由于
答案 0 :(得分:3)
您需要成为LinkedIn开发人员"合作伙伴"为了访问"媒体"控制器/端点: