skip to Main Content

I want to get the information from an specific product.

I am using this reference in this moment, and get all the products in given searchCriteria:

http://www.mysite.co/rest/V1/products-render-info?storeId=1&currencyCode=cop

Is there a way I can send the product id in the url and get only all its information?

2

Answers


  1. You can fetch product info by SKU, not ID.

    API endpoint (get method) will pull product info. vendor/magento/module-catalog/etc/webapi.xml

    /V1/products/:sku
    

    So, your rest API calling URL should be like this

    http://www.mysite.co/rest/V1/products/productsku
    

    Note: If you want to fetch product info by id, you probably need to create a simple rest API. you can check this out.
    https://magento.stackexchange.com/questions/282480/i-am-new-here-i-want-to-know-how-can-i-create-my-own-simple-api/282730

    Login or Signup to reply.
  2. You can add the filter

    http://www.mysite.co/rest/V1/products?searchCriteria[filterGroups][0][filters][0][field]=entity_id&searchCriteria[filterGroups][0][filters][0][value]=1&searchCriteria[filterGroups][0][filters][0][condition_type]=eq
    

    use field entity_id instead of id, value is product id here 1, condition_type is equal to here eq.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search