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

Receiving resource not found error when creating commerce product through headless API

written-by

Anushka Tiwari

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

Issue

  • When creating a product using headless API. After creating it, the product status shows 'Approved'; however, when searching for the product or clicking the product to open it, that shows the resource not found error on the UI.
  • Steps to reproduce:
    1. Start Liferay DXP 7.4 U90.
    2. Create a new site using the 'Minimum template'
    3. Now navigate to Applications > Workflow > Process Builder. Click on the 'Configuration' tab.
    4. Assign the 'Single approver workflow' to 'Commerce Product'.
    5. Now, navigate to Global Menu > Commerce > Catalogs. Create a demo catalog.
    6. Then go to localhost:8080/o/api > /o/headless-commerce-admin-catalog/v1.0/products.
    7. Method: POST and add the below request body. Please change the catalog ID with which we have created in the 4th step:
    {
    "active": true,
    "catalogId": 44330,
    "categories": [],
    "productType": "virtual",
    "defaultSku": "BC20247534542387",
    "name": {
    "en_US": "Product"},
    "description": {
    "en_US": "test product description"},
    "externalReferenceCode":"10141299",
    "expirationDate": "2024-11-12T12:03:45.043Z",
    "neverExpire": false,
    "skus": [
    {
    "discontinued": false,
    "externalReferenceCode": "10141299",
    "published": true,
    "price": 0,
    "promoPrice": 0,
    "purchasable": true,
    "sku": "BC20247534542387",
    "skuOptions": null
    }]}
    8. Check the product; it is in the 'Approved' state, and then navigate to the created site, find the created product, and click on this.
    Observed behavior: It is showing the error on the UI.
    Expected behavior: As this product is in an approved state, it should show the product on the UI.

Environment

  • Liferay DXP 7.4

Resolution

  • The reported issue is not a bug, this is considered to be the correct behavior of the API when working with an enabled workflow.
  • To achieve the requirement, the user can create a custom workflow and custom headless roles to be used in this scenario, so the product skips the approval step if it is created by headless API through a certain user.
  • Skipping the approval process for products created via API in a custom approval workflow. User can follow the document Single Approver Workflow: how to bypass for admin role 

Additional Information

did-this-article-resolve-your-issue

legacy-knowledge-base