Product specifications are not getting created if not available on the portal
Written By
Pooja Bhambani
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
You are viewing an article from our legacy "FastTrack"
publication program, made available for informational purposes. Articles
in this program were published without a requirement for independent
editing or verification and are provided"as is" without
guarantee.
Before using any information from this article, independently verify its
suitability for your situation and project.
Issue
- When specifications are not available on the portal. It's giving 500 Internal Server Error in the response body while creating the product via headless API.
-
Steps to reproduce:
1. Create a product by using POST /v1.0/products (Request is attached).
2. Below is the Request for product specifications:( Material and dimensions are already created/available on the portal)
"productSpecifications": [
{
"specificationKey": "material",
"value": {
"en_US": "Rubber"
}
},
{
"specificationKey": "dimensions",
"value": {
"en_US": "22mm"
}
}
]
3. In Request, change the 'material' and 'dimensions' with anything which is not available on the portal. E.g. with 'brand' and 'size'.
4. Execute it and check it's giving a 500 code response.
Expected Behavior: The product must be created with specifications.
Actual Behavior: The product is not created and it's giving a 500 response code.
Environment
- Liferay DXP 7.3
- Commerce 3.0
Resolution
- To create a specification for a product the 'label' value must be provided. Because it is the title of the specification.
- Below changes must be done to create a product.
"productSpecifications": [
{
"specificationKey": "test",
"label": {
"en_US": "Test Label"
},
"value": {
"en_US": "Rubber"
}
},
{
"specificationKey": "test",
"label": {
"en_US": "Brand"
},
"value": {
"en_US": "Apple"
}
}
]
Did this article resolve your issue ?