简体   繁体   中英

Is it possible to filter kontent results (delivery api) by linked item type

Is it possible to filter and only bring back content items what have a linked-item of type x eg

I have 3 content type A, B, and C

A has a field called subItems which takes either content type A, B or C

How would i construct a query for content-items that have at least one subItem of Content-type B

I think the scenario is not covered right in filtering operators .

On the other hand, you could filter out content items with [any] filter if you have their codename.

  1. Load codenames of Content-type B
  2. Use [any] operator for subitems element with loaded codenames

You could load codenames of Content-type B items using /items endpoint.

To prevent loading data you don't need (in that case you want to ignore all elements , you just need codename) you could use projection feature .

If you have more than 2000 content items (or hitting response size any other way) of type B, use /items-feed and load items page by page.

https://deliver.kontent.ai/<PROJECTID>/items?elements=null&system.type=content_type_b

And then use [any] filter:

https://deliver.kontent.ai/<PROJECTID>/items?elements.subitems[any]=<codename1>,<codename2>,...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM