Home > Net >  Strapi v4 REST API :GET image
Strapi v4 REST API :GET image

Time:12-17

please I am working with the new strapi v4 and... In the old versions of strapi all I needed to do in order to get the image from my collection type was to get it like: <img src={config.baseURL product?.productImg?.formats?.thumbnail?.url} /> but when I try to do the same now, it gives me the url address, but the response says {"data":null,"error":{"status":404,"name":"NotFoundError","message":"Not Found","details":{}}}

Could anyone please help me? Thx <3

CodePudding user response:

I realised it. In my config file I had the baseURL as 'localhost:1337/api'. However for images, you must request without the '/api' so the request should be just 'localhost:1337' and then the image route.

  • Related