documentation icon indicating copy to clipboard operation
documentation copied to clipboard

[Bug]: How do collection types get media data?

Open milerL opened this issue 2 years ago • 1 comments

Link to the documentation page or resource

https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest-api.html

Describe the bug

image This is the data I added image This is the Shu I got through the API

Why is there no media data?

How do I get media data?

Additional context

No response

Suggested improvements or fixes

I want to get complete data through API

Related issue(s)/PR(s)

No response

milerL avatar Jun 02 '22 08:06 milerL

Hello @milerL and thank you for opening this issue.

Have you tried populating the fields you're looking for? As mentioned in the introduction of this documentation, media fields are not populated by default as of Strapi v4.

By the way we are reworking this part of the documentation, so any feedback on it is appreciated :-)

pwizla avatar Jun 20 '22 14:06 pwizla

Hi @milerL, following up quickly. The correct structure to populate the media is like this: GET http://localhost:1337/api/htmls/1?populate=avatar where avatar is the name of the media field in the Content Manager. Since the issue has not had any responses for more than 2 months I will close it, but please feel free to comment or open a new issue at any time.

stb13579 avatar Aug 22 '22 15:08 stb13579