Upload video using LinkedIn V2 API

前端 未结 2 994
北海茫月
北海茫月 2021-01-14 23:15

I am trying to upload a video using LinkedIn API V2 but I am unable to post successfully video to my LinkedIn Individual Account. Please help.

Returning Below Respon

相关标签:
2条回答
  • 2021-01-14 23:54

    Hi linkedin not released video uploads yet.You can use the article EP( "shareMediaCategory": "ARTICLE") to send videos to linkedin

    0 讨论(0)
  • 2021-01-15 00:06

    I make use of the LinkedIn API from Zoonman to do the client post request, but this is out of the scope of the question.

    Because i could not get the php curl functions to work properly, i am using the command line interface to do the request, and it works! See my code below.

    BUT. even tough the upload works. When i do a request to get the status of the upload, it is still "WAITING_UPLOAD". So i think @augustine jenin is right, that it is not supported yet. (may 2019)

    <?php
    // first register upload
    $data = [
    	"registerUploadRequest" => [
    		"recipes" => [
    			"urn:li:digitalmediaRecipe:feedshare-video"
    		],
    		"owner" => "urn:li:organization:" . $liPageId,
    		"serviceRelationships"=> [
    			[
    				"relationshipType"=> "OWNER",
    				"identifier" => "urn:li:userGeneratedContent"
    			]
    		]
    	]
    ];
        
    $register = $client->post('assets?action=registerUpload', $data);
    
    // get upload url and header
    $uploadUrl = $register["value"]["uploadMechanism"]["com.linkedin.digitalmedia.uploading.MediaUploadHttpRequest"]["uploadUrl"];
    $headers = $register["value"]["uploadMechanism"]["com.linkedin.digitalmedia.uploading.MediaUploadHttpRequest"]["headers"];
        
    $curlHeaders = "";
    foreach($headers as $htype => $header) {
    	$curlHeaders .= ' -H "' . $htype . ':' . $header . '"';
    }
    
    // go upload the image to the url
    $filePath = "/path/to/your/file";
    
    $command = '/usr/bin/curl -v';
    $command .= $curlHeaders;
    $command .= ' --upload-file \'' . $filePath . '\' \'' . $uploadUrl . '\'';
    
    // try it yourself by running this on the command line
    //echo $command;
    
    shell_exec($command);
    
    ?>

    0 讨论(0)
提交回复
热议问题