0
votes

I am trying to write a code for making posts in my LinkedIn group automatically. I am using the following API command (with my person and group):

POST
https://api.linkedin.com/v2/ugcPosts

BODY
{
    "author": "urn:li:person:123ABC", 
    "containerEntity": "urn:li:group:123", 
    "lifecycleState": "PUBLISHED", 
    "specificContent": {
        "com.linkedin.ugc.ShareContent": {
            "media": [
                {
                    "description": {
                        "attributes": [], 
                        "text": "Check out our awesome group!"
                    }, 
                    "status": "READY", 
                    "thumbnails": [], 
                    "title": {
                        "attributes": [], 
                        "text": "Group Post!"
                    }
                }
            ], 
            "shareCommentary": {
                "attributes": [], 
                "text": "Some group text"
            }
        }
    }, 
    "visibility": {
        "com.linkedin.ugc.MemberNetworkVisibility": "CONTAINER"
    }
}

But I am getting that error:

{"serviceErrorCode":100,"message":"Unpermitted fields present in REQUEST_BODY: Data Processing Exception while processing fields [/containerEntity]","status":403}

I registered an application and get the access token in scope w_member_social. Do I understand correctly that I lack access for using this command? Please, help me.

1
403 is forbidden error. you might not have access to do that. You should check documentation. - Himanshu Bansal
Improved formatting - Eugene Primako
You might want to check the resource requesting url (all the values after the base POST url). I've run into a similar problem and found my oauth request library had been appending key value pairs to the url which were causing this exact error. I would just removed all the stuff it was adding, in your case the containerEntity, and see if it goes through. GLHF. - TekkSparrow

1 Answers

0
votes

I would suggest to change

"com.linkedin.ugc.MemberNetworkVisibility": "CONTAINER"

to

"com.linkedin.ugc.MemberNetworkVisibility": "PUBLIC"