Hi! I am trying to fetch repeatable data from a slice using GraphQL, however when I use the explorer it says that fields (or primary) can't be queried on my slice type. I have published content and made sure that the API IDs are all lower cased according to the bug reports for fetching slice data.
Appreciate any help on this matter. As I understand from the documentation I should be able to query primary and fields on the same level as type and level.
Hi Tania,
You might get this error if your slice has a variation, then your query might look like:
{
allAbouts {
edges {
node {
slices {
... on AboutSlicesAbout_block {
variation {
... on AboutSlicesAbout_blockDefault {
fields {
// ...
}
}
}
}
}
}
}
}
}
Give that a try and let me know if it helps.
Sam
Hi Sam! Thank you for reply. I only have the default variation, which is why I didn't think it was necessary to define. When I do it the way you suggest I still get an error for fields. The graphQL explorer is suggesting "items" instead, which is now working for me, so all good! Although bit confusing as I see no mentioning av items in the documentation. However in the Slice Machine I can see that the IDs are named like so
slice.items[i].about_slice_heading
Please see attachment for reference of explorer.