After accessing the Rest API ( to get the product details, the response is something like this:

{ "attribute_code": "image", "value": "/6/4/64275-152378-large.jpg" }, { "attribute_code": "small_image", "value": "/6/4/64275-152378-large.jpg" }, { "attribute_code": "thumbnail", "value": "/6/4/64275-152378-large.jpg" }

What should be the base url/prefix for the jpg in the attribute_code keys ?

  • have you tried : api/rest/products/sku/images?
    – Abdul
    Commented Dec 8, 2015 at 12:06
  • this link does not work in magento 2.0
    – devdoe
    Commented Dec 8, 2015 at 13:05
  • Magento 2 : /V1/products/:sku/media
    – Abdul
    Commented Dec 8, 2015 at 13:18
  • Check my answer.. all the api's in 2.0 will give you an incomplete URL.. you can hardcode the directory path.
    – devdoe
    Commented Dec 8, 2015 at 13:20

2 Answers 2


In Magento 2x the product image urls are all relative. It's possible some extension or usage of CDN could change the base path. You can call the the V1/store/StoreConfigs api and use the baseMediaUrl value to get the full path.


Found the URL on server directory. Just add a prefix to the URL.

Prefix: http://magento.com/pub/media/catalog/product/(url in API response)

  • This would be safe as long as no one has changed the Base URL for User Media Files value from Admin->Stores->General->Web. (This was the point which @Chuck was making in the other answer.) Commented Jul 18, 2017 at 11:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.