How to get custom image type attribute value from product magento 2?

We can able to fetch the Custom Image Type product attribute value from the Product object by just fetching the product object.

Let’s say you have created a custom image_type product attribute called, brand_logo and you want to fetch the value saved for a product by product object. You can refer to the below logic to fetch the image value.

You can fetch the value of the image attribute by calling the below line,

I hope you have fetched the Product Object by the ProductRepositoryInterface, You can check the logic, Fetch Product Object By SKU

$product->getData('brand_logo');

Using the above stuff, You will get the file path of the image in the response.

How to update product images by REST Web API Magento 2?

You can upload product images by REST API Magento with the PUT action and the help of /V1/products/<sku>.

Action: PUT

URL: <BASE_URL>/rest/V1/products/<SKU>
(Example URL: https://magento.test/rest/V1/products/my-sku)

Header: Authorization: Bearer <ADMIN TOKEN> Continue reading “How to update product images by REST Web API Magento 2?”

How to fetch product media gallery images URL using GraphQl Magento 2?

You can fetch the product media gallery images as well as the main Image, Thumbnail, Swatch Image, and Small Image URL by GraphQl.

You have to pass SKU in the product search query to get the product image URL.

GraphQl Query Request Body: Continue reading “How to fetch product media gallery images URL using GraphQl Magento 2?”