How to query data of Content Relation field in Slice

Ok, now this is ridiculous. The documentation is completely out of date, and this was addressed months ago.

Please fix the docs and stop sending people to read them if you aware that they are out of date.

I managed to find a solution by reading other threads like this or this.

@Priyanka I've found your reply in a thread similar to this one, and it has example with correct API using slices and variation fields, but in the docs there are no mentions of those. Instead of it there is a query example with body (which is unable to find) and repeat fields.

For anyone desperately looking for a working example just like me, my query which works as expected is:

await client.getByUID<GameDocument>('game', params?.uid as string, {
  graphQuery: `
    {
      game {
        ...gameFields
        slices {
          ...on assets_grid {
            variation {
              ...on default {
                items {
                  asset {
                    ...on asset {
                      ...assetFields
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  `,
})
1 Like