0

i have images that are in an array in strapi, and i am using this api url to fetch the data: http://localhost:1337/barbers-stores?populate=*. Here is the data i have, as you can see in the returned data, the StoreImage property returns the image(with url), but they are not visible in the "bserv" or "barber_services" properties....only seeing the createdAt, updatedAt piece of data. how do i fix this?

RETURNED DATA

{
    "data": [
        {
            "id": 1,
            "attributes": {
                "StoreName": "FanatII Cutz",
                "createdAt": "2023-08-02T08:08:03.580Z",
                "updatedAt": "2023-08-02T12:44:30.389Z",
                "publishedAt": "2023-08-02T08:08:05.229Z",
                "StoreLocation": "Vancouver, United States",
                "StoreImage": {
                    "data": {
                        "id": 3,
                        "attributes": {
                            "name": "barber_5.jpg",
                            "alternativeText": null,
                            "caption": null,
                            "width": 5184,
                            "height": 3456,
                            "formats": {
                                "thumbnail": {
                                    "name": "thumbnail_barber_5.jpg",
                                    "hash": "thumbnail_barber_5_292c186472",
                                    "ext": ".jpg",
                                    "mime": "image/jpeg",
                                    "path": null,
                                    "width": 234,
                                    "height": 156,
                                    "size": 13.29,
                                    "url": "/uploads/thumbnail_barber_5_292c186472.jpg"
                                },
                                "small": {
                                    "name": "small_barber_5.jpg",
                                    "hash": "small_barber_5_292c186472",
                                    "ext": ".jpg",
                                    "mime": "image/jpeg",
                                    "path": null,
                                    "width": 500,
                                    "height": 333,
                                    "size": 46.68,
                                    "url": "/uploads/small_barber_5_292c186472.jpg"
                                },
                                "medium": {
                                    "name": "medium_barber_5.jpg",
                                    "hash": "medium_barber_5_292c186472",
                                    "ext": ".jpg",
                                    "mime": "image/jpeg",
                                    "path": null,
                                    "width": 750,
                                    "height": 500,
                                    "size": 94.13,
                                    "url": "/uploads/medium_barber_5_292c186472.jpg"
                                },
                                "large": {
                                    "name": "large_barber_5.jpg",
                                    "hash": "large_barber_5_292c186472",
                                    "ext": ".jpg",
                                    "mime": "image/jpeg",
                                    "path": null,
                                    "width": 1000,
                                    "height": 667,
                                    "size": 151.62,
                                    "url": "/uploads/large_barber_5_292c186472.jpg"
                                }
                            },
                            "hash": "barber_5_292c186472",
                            "ext": ".jpg",
                            "mime": "image/jpeg",
                            "size": 3738.33,
                            "url": "/uploads/barber_5_292c186472.jpg",
                            "previewUrl": null,
                            "provider": "local",
                            "provider_metadata": null,
                            "createdAt": "2023-08-02T11:27:28.945Z",
                            "updatedAt": "2023-08-02T11:27:28.945Z"
                        }
                    }
                },
                "barber_services": {
                    "data": [
                        {
                            "id": 6,
                            "attributes": {
                                "createdAt": "2023-08-15T11:20:52.769Z",
                                "updatedAt": "2023-08-15T11:25:24.711Z",
                                "publishedAt": "2023-08-15T11:20:54.977Z",
                                "ServicePrice": 100,
                                "ServiceName": "Mohawk"
                            }
                        }
                    ]
                },
                "members": {
                    "data": [
                        {
                            "id": 1,
                            "attributes": {
                                "Name": "Mandlenkosi",
                                "PhoneNumber": "785517023",
                                "createdAt": "2023-08-11T10:37:03.372Z",
                                "updatedAt": "2023-08-11T10:37:12.546Z",
                                "publishedAt": "2023-08-11T10:37:05.130Z",
                                "Email": "mandlankosi739@gmail.com"
                            }
                        }
                    ]
                },
                "bserv": {
                    "data": {
                        "id": 1,
                        "attributes": {
                            "createdAt": "2023-08-15T11:29:12.070Z",
                            "updatedAt": "2023-08-15T11:39:12.154Z",
                            "publishedAt": "2023-08-15T11:39:12.143Z"
                        }
                    }
                }
            }
        }
    ]
}

1 Answers1

0

I found the solution whereby, in order to populate deeper using - http://localhost:1337/api/categories?populate[barber_services][populate]=* .

This will populate all the relations including their images. Here's a similar reference: https://stackoverflow.com/a/70251184/17908449