4
votes

While posting to a group via LinkedIn API following the "Create a Group Post" example here:

https://docs.microsoft.com/en-us/linkedin/compliance/integrations/groups/group-posts-and-actions?context=linkedin/compliance/context

I always receive: "Unpermitted fields present in REQUEST_BODY: Data Processing Exception while processing fields [/containerEntity]"

Our app is a marketing developer platform partner. I gain w_organization_social, w_member_social, rw_organization_admin, r_liteprofile, r_emailaddress permissions while authorizing. I can successfully post to an organization page.

How could I fix this error? Do we need to request additional permissions?

Request details:

REQUEST: https://api.linkedin.com/v2/ugcPosts
METHOD: HttpMethod(value=POST)
COMMON HEADERS
-> X-Restli-Protocol-Version: 2.0.0
-> Authorization: Bearer <...>
-> Accept: application/json
-> Accept-Charset: UTF-8
BODY Content-Type: application/json

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

3 Answers

1
votes

I was looking at the sample code in your link:

{
    "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"
    }
}

I noticed that in the sample code, it’s media:[ ]

But in your code you didn’t use an [ ] That’s probably why you’re receiving this error message.

0
votes

Assuming that your full error is the same from this post:

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

403 being a forbidden error, you didn't mention the r_organization_social permission for the ugcposts endpoint. You need w_organization_social, r_organization_social, w_member_social and your OP only shows 2 of the 3.

A UGC Post can't be sent without containerEntity so you can't just remove that and test, and the formatting you are using looks correct to their docs for V2. Not a LinkedIn partner so can't test and corroborate the error myself, unfortunately, but verify you have all the appropriate permissions.

-1
votes

Since you are using the new protocol X-Restli-Protocol V2, you should try changing any instance of a list "[something,something2]" with "List(something,something2)". Also remember to url-encode (encodeURIComponent() for javascript) any URN you're passing to that list.

Glad to help.