2

I have LinkedIn app (Created from here https://www.linkedin.com/developer/apps) with scope of r_basicprofile, r_emailaddress, rw_company_admin, w_share

After completing auth process successfully i got access token from linkedin api and it's working to get authenticated user information.

But while i try to use Rich Media Shares API then it's not working for me I am getting following error

{

   "serviceErrorCode":100,

   "message":"Not enough permissions to access media resource",

   "status":403

}

Here is the request code sample

$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;
}

Thanks

Mehul V.
  • 620
  • 3
  • 13

1 Answers1

3

You need to be a LinkedIn developer "Partner" in order to access the "media" controller/endpoint:

https://developer.linkedin.com/partner-programs

JoeDuncan
  • 367
  • 3
  • 8
  • 2
    It would be **really** nice if this requirement were listed [in the documentation](https://learn.microsoft.com/en-us/linkedin/marketing/integrations/community-management/shares/rich-media-shares). (It's not; I spent the time writing the code to integrate this only to realize we don't have access) – rinogo Jun 27 '19 at 22:42
  • 1
    Yeah, LinkedIn's reference docs for developers IS somewhat, ahem, lacking. – JoeDuncan Jul 03 '19 at 15:11