Issue
-
Steps to reproduce:
1. Create a Minium site (so that you have products generated).
2. Create a new object "manufacturer" (I set it to company scope, and to appear in Applications/Content - "Panel Link").
3. I added a field "name" to it.
4. I created a one-to-many relationship with the Commerce Product object.
5. I created a new Layout for this object with a Fields tab showing the name field and a Relationship tab for the relationship defined above. Also set this layout to be the default one.
6. Then I went to Applications/Content/Manufacturers and I created a new manufacturer "Audi" and I opened it, went to the relationship tab and added a couple of products here: ABS Sensor and Brake Fluid.
7. I went to Commerce/Products and clicked on the ABS Sensor product. Noted down the ERC: MIN93015minium-initializer
8. I went to the API GUI at /o/api and selected headless-commerce-admin-catalog.
9. Scrolled down to the Product section and called the GET /v1.0/products/by-externalReferenceCode/{externalReferenceCode} API by providing the ERC above.
10. From the response I searched for productId and noted it down,
11. Then I expanded the GET/v1.0/products/{id} API
Checkpoint: in the response example value we can see towards the ends lines like these:"r_manufacturerProducts_c_manufacturerERC": "string", "r_manufacturerProducts_c_manufacturerId": 0, "manufacturerProducts": {}12. Then I called this API with the productId from above.
Result: at the end, the response only has this line"r_manufacturerProducts_c_manufacturerERC": "2368d06c-d32a-c6de-2985-24d2b99f70b2"
Expected: it should also have those other two lines present and properly filled out (as the GUI example indicated before actually running the API)
Environment
- 2024.Q1
Resolution
-
manufacturerProductsis an optional field. We do not return all the information by default to not overload the response. To retrieve the information, you have to add the nestedFields parameter to the request:
nestedFields=manufacturerProducts