'Using slug as a filter with Graphql and Strapi V4

Trying to use slug as an uuid to fetch single pages from a strapi backend v4. my query to get pages works well. It's just I can't filter using slug:

my pages query:

  query {
   pages {
    data {
      attributes {
            Name
            slug
      }
    }
 }
}

how to get single page using slug uuid within this schema ? every trails to implement ($slug: String!) fails as where to locate slug.



Solution 1:[1]

Try this

query pages($id: ID) {
  page(id: $id) {
    data {
      attributes {
        name
        slug
      }
    }
  }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Xavier Lambros