0

I'm not able to Create an Image Share

I've already tried "Create a Text Share", "Create an Article or URL Share" on this link : https://learn.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/share-on-linkedin (it works)

$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$uploadurl = $content['value']['uploadMechanism']['com.linkedin.digitalmedia.uploading.MediaUploadHttpRequest']['uploadUrl'];
curl_setopt($ch, CURLOPT_URL, $uploadurl);
$postData = array('upload-file' => $image_path,);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
$response = curl_exec($ch);

I am getting an error when using the code

HTTP/2 400 
server: Play
set-cookie: lang=v=2&lang=en-us; Path=/; Domain=api.linkedin.com
date: Tue, 25 Jun 2019 13:20:18 GMT
content-length: 0
x-li-fabric: prod-lsg1
x-li-pop: prod-tmu1-tls13
x-li-proto: http/2
x-li-uuid: yHH9/J1zqxUg49zQTisAAA==
set-cookie: lidc="b=SB01:g=126:u=36:i=1561468818:t=1561546488:s=AQFBkUrPOpXyD1XtJHm-uvTC74dEZLtT"
x-li-route-key: "b=SB01:g=126:u=36:i=1561468818:t=1561546488:s=AQFBkUrPOpXyD1XtJHm-uvTC74dEZLtT"
ADyson
  • 57,178
  • 14
  • 51
  • 63
developer
  • 1
  • 2
  • Please elaborate on the error you're receiving when you try this. [ask] – kenlukas Jun 27 '19 at 12:29
  • we can't guess what your error is, please tell us – ADyson Jun 27 '19 at 13:17
  • Is the problem that you're getting a "400" response from the server? If so it means that somehow you didn't supply the correct data to the server. Usually the response body would contain more details of what it expects you to send. – ADyson Jun 27 '19 at 13:22
  • P.S. I remove the "api" tag - it has a big "DO NOT USE" label on it when you hover over it to get the description - always check the tags before you add them to your question - thanks. – ADyson Jun 27 '19 at 13:25
  • Use this answer to share the image on linkedin with the v2 api https://stackoverflow.com/a/56777057/1564956 – KCP Jun 27 '19 at 13:28
  • @kenlukas i got response when i tried to upload image to ulpoad url (which is came from assets?action=registerUpload request) , one main thing is when i run that code i am getting urn:li:share:id even there is an error in code. – developer Jun 28 '19 at 07:45

0 Answers0