1
votes

Have permission issue when trying to create UGC post via API with type VIDEO. All other ugc post types work as expected. Get the following issue:

{ "message": "com.linkedin.publishing.util.common.ResponseException: urn:li:developerApplication:7242213 does not have permission to create ugc posts",
"status": 401 }
Request:
<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => "https://api.linkedin.com/v2/ugcPosts",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => "{\n    \"author\":\"urn:li:person:<person ID>\",\n    \n    \"lifecycleState\": \"PUBLISHED\",\n    \"specificContent\": {\n        \"com.linkedin.ugc.ShareContent\": {\n            \"media\": [\n                {\n                    \"description\": {\n                        \"attributes\": [],\n                        \"text\": \"Sample Description\"\n                    },\n                    \"media\": \"urn:li:digitalmediaAsset:C4D05AQEulqRDlCUbSA\",\n                    \"status\": \"READY\",\n                    \"originalUrl\": \"https://seosamba.com\",\n                    \"title\": {\n                        \"text\": \"Official LinkedIn Blog\"\n                    }\n                }\n            ],\n            \"primaryLandingPageUrl\": \"https://seosamba.com\",\n            \"shareCommentary\": {\n                \"attributes\": [],\n                \"text\": \"Some share text\"\n            },\n            \"shareMediaCategory\": \"VIDEO\"\n        }\n    },\n  \n    \"visibility\": {\n        \"com.linkedin.ugc.MemberNetworkVisibility\": \"PUBLIC\"\n    }\n}\n",
  CURLOPT_HTTPHEADER => array(
    "authorization: Bearer AUTH TOKEN",
    "cache-control: no-cache",
    "content-type: application/json",
    "postman-token: 1abac8b6-bbc1-0acd-b469-f83715faeea2",
    "x-restli-protocol-version: 2.0.0"
  ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}

1
The error is definitely helpful, but please provide code showing your API request you're sending. - Derek Joseph Olson
I also have the same issue. I assume that this needs to be enabled from the LinkedIn side? I don't see this documented anywhere. - Usama Ejaz

1 Answers

0
votes

I sent request to LI Support and that what I got back (two weeks ago):

"Hello Alexey,

Creating video UGC posts is currently a whitelisted feature. There is currently hold on whitelisting new apps for video.

You may continue to create UGC posts that are not video though.

I'll put this on hold until I have more information on when we can whitelist apps again.

Best, Mike"

Anyway I tried this for a test and don't need VIDEO at this moment. I suggest you to contact support to re-check this.