legacy-knowledge-base
公開されました Jun. 30, 2025

Webコンテンツ構造のインポートとオーバーライドを実行するためのRest API

written-by

Sorin Pop

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

問題

  • Liferayは、Web ContentのStructureタブにある "Import and Override "オプションのように、エクスポートされた構造のJSONをLiferay DBに保存するために使用できるRest APIを提供していますか?
  • より正確には、次のような単純なユースケースを想像してほしい:
    1. サイトS1を作成し、その中にウェブコンテンツ構造STR1を作成する。
    2. STR1をJSONファイルにエクスポートします。
    3. 別のサイトS2を作ってから、
      • Web Content > Structure > 右上の3点メニュー > Import Structure のいずれかを選択します。
      • または、新しいストラクチャーを作成し、その横にある3つの点から > Import and Override を選択する。
  • REST APIコールを使ってこれらのアクションを行うにはどうすればいいのでしょうか?

環境

  • 7.4

解像度

  • これにはData EngineのヘッドレスAPIを使うことができる。
  • 新しい構造をインポートする:
    curl -X 'POST' \
    'http://localhost:8080/o/data-engine/v2.0/sites/{siteId}/data-definitions/by-content-type/{contentType}' \
    ...
    • ウェブコンテンツの場合、contentTypeとして journalを設定する必要があります。
    • Documents & Mediaの場合、contentTypeとして document-libraryを設定する必要があります。
  • インポートして上書き:
    curl -X 'PUT' \ 
    'http://localhost:8080/o/data-engine/v2.0/data-definitions/{structureId}' \
    ...
  • どちらの場合も、省略記号(...)は新しい構造体のJSONテキストを表している。
  • また、Liferay API Explorerの Data Engine > DataDefinition のセクションを使用することもできます。
did-this-article-resolve-your-issue

legacy-knowledge-base