最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Strapi CMS third level populating - Stack Overflow

programmeradmin0浏览0评论

I have a problem with fetching third level data from Strapi CMS.

My Structure is the following:

Page > Content(Dynamic Zone) > Multiple Entitys e.g. HeroSliderElement.

So Calling this URL from Postman:

{{protocol}}://{{host}}:{{port}}/api/pages?populate[Content][populate]=*

But since inside my HeroSliderElement are images i have the problem, that i dont get these back.

There should be the media data linked from the CMS:

Does anyone have an Idea how to fix this? Any help is appreciated!

I am currently using the following versions of packages:

  "dependencies": {
"@strapi/plugin-i18n": "4.0.7",
"@strapi/plugin-users-permissions": "4.0.7",
"@strapi/provider-upload-aws-s3": "^4.1.0",
"@strapi/strapi": "4.0.7",
"pg": "8.6.0",
"strapi-provider-upload-aws-s3": "^3.6.8"

},

I have a problem with fetching third level data from Strapi CMS.

My Structure is the following:

Page > Content(Dynamic Zone) > Multiple Entitys e.g. HeroSliderElement.

So Calling this URL from Postman:

{{protocol}}://{{host}}:{{port}}/api/pages?populate[Content][populate]=*

But since inside my HeroSliderElement are images i have the problem, that i dont get these back.

There should be the media data linked from the CMS:

Does anyone have an Idea how to fix this? Any help is appreciated!

I am currently using the following versions of packages:

  "dependencies": {
"@strapi/plugin-i18n": "4.0.7",
"@strapi/plugin-users-permissions": "4.0.7",
"@strapi/provider-upload-aws-s3": "^4.1.0",
"@strapi/strapi": "4.0.7",
"pg": "8.6.0",
"strapi-provider-upload-aws-s3": "^3.6.8"

},

Share Improve this question edited Apr 1, 2022 at 13:14 SupaMario asked Mar 26, 2022 at 8:46 SupaMarioSupaMario 1,1461 gold badge12 silver badges16 bronze badges 0
Add a comment  | 

4 Answers 4

Reset to default 12

Install the official strapi plugin : strapi-plugin-populate-deep , its easy and great plugin for nested content structure, it worked for me.

Examples: Populate a request with the default max depth.

/api/articles?populate=deep

Populate a request with the a custom depth

/api/articles?populate=deep,10

Populate a request with the a custom depth

/api/articles/1?populate=deep,10

In case you're still looking for a solution, refer to answer here - Strapi V4 populate dynamic zones media not populating

you need to specify every record(object, entity) at level three to fetch data from it. like as you said you want to fetch data of images from content from your this will work

{{protocol}}://{{host}}:{{port}}/api/pages?populate[Content][populate]=images

You can use this awesome plugin, it works like a charm strapi-plugin-populate-deep

发布评论

评论列表(0)

  1. 暂无评论