Hello!
I have categories endpoint and they’re linked with articles. On our homepage I want to show the last 10 articles from each category.
However, I cannot get the pagination to work with populate.
Here’s the endpoint
localhost:1337/api/categories?populate[articles][populate][image]=%2A&populate[articles][fields][0]=title&populate[articles][fields][1]=description&populate[articles][pagination][pageSize]=1&populate[articles][sort][0]=createdAt%3Adesc&populate[svg][populate]=%2A&filters[site][id]=1
I’m also attaching the code (might be easier to understand). It’s parsed with qs.stringify qs.stringify(urlParamsObject, { encodeValuesOnly: true })
fetchAPI("/categories", {
populate: {
articles: {
populate: {
image: "*",
},
fields: ["title", "description"],
pagination: {
pageSize: 1,
},
sort: ["createdAt:desc"],
},
svg: {
populate: "*",
},
},
filters: {
site: {
id: siteId,
},
},
}),
Does anyone know where the problem is?
Thank you very much!