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

リレーションシップを持つコマース製品のAPIレスポンスにmanufacturerProductsネストされたフィールドが含まれない

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

問題

  • 再現の手順
    1.
    2.ミニサイトを作成する。 新しいオブジェクト "manufacturer "を作成する(会社のスコープに設定し、Applications/Content - "Panel Link "に表示されるようにした)。
    3.
    4.
    5. Commerce Productオブジェクトと一対多のリレーションを作成した。 このオブジェクトの新しいレイアウトを作成し、名前フィールドを表示する「Fields」タブと、上で定義したリレーションシップを表示する「Relationship」タブを設けました。 また、このレイアウトをデフォルトに設定する。
    6. そして、Applications/Content/Manufacturersに行き、新しいメーカー "Audi "を作成し、それを開き、Relationshipタブに行き、ここにいくつかの製品を追加した:
    7. Commerce/Productsに行き、ABS Sensor製品をクリックしました。 ERC: MIN93015minium-initializer
    8. /o/api にある API GUI にアクセスし、headless-commerce-admin-catalog を選択しました。
    9. Product セクションまでスクロールダウンし、上記の ERC を指定して GET /v1.0/products/by-externalReferenceCode/{externalReferenceCode} API を呼び出します。
    10. 回答からproductIdを検索し、
    11。 そして、GET/v1.0/products/{id} API
    Checkpoint: を展開したところ、レスポンス例の値の末尾に以下のような行があった:

    "r_manufacturerProducts_c_manufacturerERC": "string", "r_manufacturerProducts_c_manufacturerId": 0, "manufacturerProducts": {}

    12.
    結果:最後に、レスポンスには次の行だけがある。

    "r_manufacturerProducts_c_manufacturerERC": "2368d06c-d32a-c6de-2985-24d2b99f70b2"


    期待されること:他の2行も存在し、適切に記入されていること(実際にAPIを実行する前にGUIの例で示されたように)。

環境

  • 2024.Q1

解像度

  • manufacturerProducts はオプションフィールドです。 レスポンスに過度の負荷をかけないよう、デフォルトではすべての情報を返しません。 情報を取得するには、リクエストにnestedFieldsパラメータを追加する必要があります:

    nestedFields=manufacturerProducts

did-this-article-resolve-your-issue

legacy-knowledge-base