Magento 2 Rest API to get product details by SKU with selected fields

Magento 2 Rest API to  get product details by SKU with selected fields

According to our requirement sometimes we need only particular fields of products.  Below is the API

which will fetch product details by SKU. You need to replace https://store.com with your store URL.

URL: https://store.com/rest/V1/products/testsku?fields=name,sku,extension_attributes[category_links,stock_item[item_id,qty]]

ENDPOINT :  /rest/V1/products/SKU?fields=name,sku,extension_attributes[category_links,stock_item[item_id,qty]]

METHOD: GET

HEADERS : Content-Type application/json

Authorization: Bearer

PARAMETERS: None

PAYLOAD: None

AUTHENTICATION: ADMIN TOKEN      Create admin Token Magento 2

Response JSON:

{

    "sku""testsku",

    "name""Products test",

    "extension_attributes": {

        "category_links": [

            {

                "position"0,

                "category_id""2"

            },

            {

                "position"0,

                "category_id""3"

            }

        ],

        "stock_item": {

            "item_id"3207,

            "qty"1000

        }

    }

}

0   0
Eecrets Magento

Related Post

11th March 2021

Magento 2 Rest API to get product details by Product SKU

Magento 2 Rest API to get product details by Product SKU....

read more reply

11th March 2021

Magento 2 Rest API to get all products

In Magento 2 we can get the list of products with the rest API with an admin token. You need to replace store.com with your store URL.....

read more reply

12th September 2020

Magento2 Get Admin Token Rest API

Magento2 Get Admin Token Rest API....

read more reply

List Your Business

Improve Your Business Visibility

Please rotate your device

We don't support landscape mode on your device. Please rotate to portrait mode for the best view of our site