Improvement: adding INNER JOINS concept in CDA API: ask for the top/root-parent entries given a child entry

Hi Contentful Guys!
Regarding the problem: ‘ask for the top/root-parent entries given a child entry’
I miss a feature to do INNER JOINS in contentful. We can achieve the same doing a lot of recursive calls to the contentful server to resolve this problem, but it could be fine to have a method in the CDA API to ask for the top/root-parent entries for a given child entry.
for example:

  • We have a content type which are the Engines of a car: TDI 1.9, TSI 1.8 etc (inner child entity)
  • We have a content type which are the Cars of a brand: Golf, Clio, Passat, etc (parent entity)
  • We have a content type which are the Brands of the market: Volkswagen, Audi, Renault, etc (root, top, or grand-parent entity)

So if we want to know which Brands are using a specific engine, we have to ask for the specific Engine entry first, and with that entry, we have to get the inbound links of the Cars, and ask for every Car entry, we have to ask to contentful for his inbound links which are the root entries in this example. This can be modeled using recursion, but it’s not really easy to maintain neither it’s really efficient because you are querying a lot of times to contentful. Especially when you have a lot of nested levels of the content types this is a nightmare.

In SQL this problem can be resolved using INNER JOINS between tables, but here I miss this feature in the CDA API.

In SQL can be:
SELECT B.* FROM BRANDS B
INNER JOIN CARS C ON B.CAR_ID = C.ID
INNER JOIN ENGINES E ON C.ENGINE_ID = E.ID
WHERE
E.ID = ‘TDI 1.9’

With only a query we have all the information!

So in order to improve the CDA API, it could be fine count/add with this feature in the future versions of the CDA API

Thanks in advance.

3 Likes