Fetch trackedEntityInstance images from they attributes(Issue)

Morning. In Tracker Capture app, the fileresources/imageId object response is used to fetch images on trackedEntityInstances/teiId/attributeId ? I’m only doing get to trackedEntityInstances/teiId/attributeId cuz I don’t see any required fileresources/imageId object on payloud. But my image comes broken from the request.

This is the error i’m facing, the image comes broken.
Capture 3

2 Likes

Hi @Celso

Welcome to the community! :tada:

Please try to add ‘image’ to the request url: trackedEntityInstances/teiId/attributeId/image

Hope this solves the issue! :+1:

Hi @Gassim

I made a mistake on my post above. I used trackedEntityInstances/teiId/attributeId/image and not trackedEntityInstances/teiId/attributeId as I wrote.

I had a solution but it was only using axios.

await axios({ method: 'GET', url: {baseUrl}/api/trackedEntityInstances/${teiId}/${attribute.imageAttributeId}/image?dimension=MEDIUM, responseType: 'blob', headers: { Authorization: Basic ${btoa(${username}:${password})}`, ‘Content-Type’: ‘application/json’ } }).

So I had the images loading without breaking. Thats fixed my problem. Thanks

2 Likes

Hi @Celso

Thank you for sharing the solution! :pray: