legacy-knowledge-base
公開されました Sep. 10, 2025

JSON Web サービスを使用して組織に関連付けられたグループを取得する方法

written-by

Ricardo Couso

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

legacy-article

learn-legacy-article-disclaimer-text

問題

  • 組織に関連付けられたグループ (つまり、サイト) を取得するために JSON Web サービス API で使用できる方法はありません。 それらを取得する方法はありますか?

Environment

  • ライフレイ DXP 7.0、7.1、7.2、7.3

解決策

  • JSON WS API には、目的の結果を得るために組み合わせることができる補助的なメソッドが 2 つあります。
    • /organization/get-organizations:
      • 入力: companyId, parentOrganizationId
      • 出力: [Organization]
    • /group/get-organizations-groups
      • 入力: [Organization]
      • 出力: [Group]
  • 複合オブジェクト 組織 および グループ は、JSON オブジェクトとして表されます。
  • これら 2 つのメソッドは 構成可能です: /organization/get-organizations の出力は、変更せずに /group/get-organizations-groupsの入力として使用できます。
  • 例:
    1. 最初のメソッド /organization/get-organizations 次のコマンドで呼び出すことができます。
      curl http://localhost:8080/api/jsonws/organization/get-organizations \
      -u test@liferay.com:test \
      -d companyId=20101 \
      -d parentOrganizationId=0
      ここで、 companyId=20101を持つ特定の Liferay インスタンスを選択し、 parentOrganizationId=0を持つ組織に制限はありません。
    2. 出力は JSON リストです。
      [
      {
      [...], "companyId": "20101", [...], "organizationId": "41003", "parentOrganizationId": "0", [...]
      },
      {
      [...], "companyId": "20101", [...], "organizationId": "41008", "parentOrganizationId": "0", [...]
      }
      ]
    3. この出力はエスケープして、2 番目のメソッド /group/get-organizations-groupsの入力として使用できます。
      curl http://localhost:9090/api/jsonws/group/get-organizations-groups \
      -u test@liferay.com:test \
      -d organizations=%5B%0A%20%20%7B%0A%20%20%20%20%22comments%22[...]%20%7D%0A%5D
    4. 出力は、目的のグループを含む別の JSON リストです。
      [
      {
      [...], "groupId": "41005", "groupKey": "org01 LFR_ORGANIZATION", [...]
      },
      {
      [...], "groupId": "41010", "groupKey": "org02 LFR_ORGANIZATION", [...]
      }
      ]
did-this-article-resolve-your-issue

legacy-knowledge-base