# Query slice with graphql and use it in the SliceZone

**URL:** <https://community.prismic.io/t/query-slice-with-graphql-and-use-it-in-the-slicezone/8445>\
**Category:** Developing with Prismic\
**Tags:** graphql\
**Created:** [December 22, 2021, 1:37am UTC](https://community.prismic.io/t/query-slice-with-graphql-and-use-it-in-the-slicezone/8445 "2021-12-22T01:37:09Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jprzpam](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jprzpam](https://community.prismic.io/u/jprzpam)\
**Post date:** [December 22, 2021, 1:37am UTC](https://community.prismic.io/t/query-slice-with-graphql-and-use-it-in-the-slicezone/8445/1 "2021-12-22T01:37:09Z")

</div>

I have the following query for fetching all slices from a Course document and it seems to work well;

```auto
const cursoQuery = gql`
  query cursoQuery($uid: String) {
    allCursos(uid: $uid) {
      edges {
        node {
          _meta {
            id
            uid
            type
          }
          title
          meta_title
          meta_description
          level
          grade
          slices1 {
            ... on CursoSlices1General_social_card {
              type
              variation {
                ... on CursoSlices1General_social_cardDefaultSlice {
                  primary {
                    title
                    description
                    image
                  }
                }
              }
            }
          }
          slices {
            ... on CursoSlicesCourse_pricing_slice {
              type
              variation {
                ... on CursoSlicesCourse_pricing_sliceDefaultSlice {
                  primary {
                    title
                    description
                  }
                }
              }
            }
            ... on CursoSlicesCourse_curriculum_slice {
              type
              variation {
                ... on CursoSlicesCourse_curriculum_sliceDefaultSlice {
                  primary {
                    title
                  }
                }
              }
            }
            ... on CursoSlicesCourse_header_slice {
              type
              variation {
                ... on CursoSlicesCourse_header_sliceDefaultSlice {
                  primary {
                    title
                    description
                    modality
                    duration
                    time
                    frequency
                    image
                  }
                }
              }
            }
          }
        }
      }
    }
  }

```

It successfully returns something like this:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/b/b207b4a5f7dce89055e9debff11fcd602d206dec.png)

my problem is that when I pass it to the SliceZone I get a message saying that the the slice data is not there or might be in the wrong format.

i see that in multiple examples you do something like this

```auto
 node{
        body{
          ... on Blog_postBodyPost_text{
            type
            primary{
              rich_text
            }
          }

```

but `body` does not exist for me. Any idea on what I might be doing wrong? thanks!

---

<div class="post-metadata">

**Author:** ![Priyanka](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/priyanka/32/3223_2.png) [@Priyanka](https://community.prismic.io/u/Priyanka)\
**Post date:** [December 22, 2021, 1:42pm UTC](https://community.prismic.io/t/query-slice-with-graphql-and-use-it-in-the-slicezone/8445/3 "2021-12-22T13:42:29Z")

</div>

Hello @jprzpam

Thanks for reaching out to us.

To make sure, it seems like it's a graphql issue, not a gtaphQuery issue. Slices should come under the body objects. Can you please send me your Prismic repo URL to look into it? You can send me a private message, though.

Thanks,  
Priyanka

---

<div class="post-metadata">

**Author:** ![jprzpam](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jprzpam](https://community.prismic.io/u/jprzpam)\
**Post date:** [December 22, 2021, 7:12pm UTC](https://community.prismic.io/t/query-slice-with-graphql-and-use-it-in-the-slicezone/8445/4 "2021-12-22T19:12:38Z")

</div>

Sent, thank you.

---

<div class="post-metadata">

**Author:** ![Priyanka](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/priyanka/32/3223_2.png) [@Priyanka](https://community.prismic.io/u/Priyanka)\
**Post date:** [December 27, 2021, 1:38pm UTC](https://community.prismic.io/t/query-slice-with-graphql-and-use-it-in-the-slicezone/8445/5 "2021-12-27T13:38:00Z")

</div>

Hello @jprzpam

I apologize for being delayed in the response. I was on vacation for a few days.  
I have checked your repository and the query you are doing is correct. In your case, you have given the API ID of the SliceZone as "slices," not "body," so all slices come under the "slices" object.

Would you please send me how you integrate these slices into your project?

Thanks,  
Priyanka

---

<div class="post-metadata">

**Author:** ![jprzpam](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@jprzpam](https://community.prismic.io/u/jprzpam)\
**Post date:** [January 27, 2022, 5:36pm UTC](https://community.prismic.io/t/query-slice-with-graphql-and-use-it-in-the-slicezone/8445/9 "2022-01-27T17:36:18Z")

</div>

Hello, I got busy with other things and forgot about this issue. What do you mean with how do I integrate these slices into my project? do you mean how I pass them to the slice zone? if so, I do it like this.

```auto
        <SliceZone
          resolver={resolver}
          slices={slices}
          sliceProps={({ sliceName }) => ({
            level: sliceName === 'CoursePricingSlice' ? level : null,
          })}
        />

```

The slice object looks like this:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/d/d313d65e035aec00a2cafecc9044af218eef3cca.png)

And I get this error when visiting the page where the slices are displayed.

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/8/84f839288e3c12ad8f9016afb88e943fdfb22279.png)

Thanks!

---

<div class="post-metadata">

**Author:** ![Priyanka](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/priyanka/32/3223_2.png) [@Priyanka](https://community.prismic.io/u/Priyanka)\
**Post date:** [January 28, 2022, 10:21am UTC](https://community.prismic.io/t/query-slice-with-graphql-and-use-it-in-the-slicezone/8445/12 "2022-01-28T10:21:17Z")

</div>

Hello @jprzpam

I need more information:

1. Which SliceZone package you are using?
2. What are you returning as Slices to the page?

Thanks,  
Priyanka
