API経由でLinkedInグループに投稿できません

Aug 19 2020

こちらの「グループ投稿の作成」の例に従って、LinkedInAPIを介してグループに投稿する場合:

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

「REQUEST_BODYに存在する許可されていないフィールド:フィールド[/ containerEntity]の処理中にデータ処理例外が発生しました」を常に受け​​取ります。

私たちのアプリは、マーケティング開発者プラットフォームのパートナーです。承認中にw_organization_social、w_member_social、rw_organization_admin、r_liteprofile、r_emailaddressのアクセス許可を取得します。組織のページに正常に投稿できます。

このエラーを修正するにはどうすればよいですか?追加の権限をリクエストする必要がありますか?

リクエストの詳細:

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

回答

1 RahulIyer Aug 24 2020 at 21:58

私はあなたのリンクのサンプルコードを見ていました:

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

サンプルコードでは、メディアであることに気づきました:[]

しかし、あなたのコードでは[]を使用していません。それがおそらくこのエラーメッセージを受け取る理由です。

LoganPoynter Aug 29 2020 at 10:06

あなたの完全なエラーがこの投稿から同じであると仮定します:

{"serviceErrorCode":100、 "message": "REQUEST_BODYに存在する許可されていないフィールド:フィールドの処理中にデータ処理例外[/ containerEntity]"、 "status":403}

403は禁止されているエラーであるため、ugcpostsエンドポイントのr_organization_social アクセス許可については言及していません。必要でw_organization_social, r_organization_social, w_member_socialあり、OPには3つのうち2つしか表示されません。

UGC投稿はcontainerEntityなしでは送信できないため、それを削除してテストすることはできません。使用しているフォーマットは、V2のドキュメントに正しく表示されます。LinkedInパートナーではないため、残念ながら自分でエラーをテストして裏付けることはできませんが、適切な権限がすべてあることを確認してください。