Using variable in graphql collection request

I’m attempting to include a variable in my graphql request for a collection. Similar to an older weweb tutorial here, but I’m unclear about how to leverage the weweb variables option (underneath the Query) within my query. Any guidance is greatly appreciated.

If you can post a screenshot of what you are trying and more details and info on what you want to achieve it’s easier to help you.

Mariano, I really appreciate your help. Sorry for not initially including a screenshot.

here’s a screenshot of the graphql request which works and returns data associated with the provided ID:

I’m trying to replace the static id value within the request with a variable which I’ve defined within WeWeb. however, my syntax for inserting the variable within graphql query appears to be incorrect (I can’t embed two images unfortunately).

can you show your attempt to the solution and what error do you get?

Sorry for delay, I was testing further with my team and realized my initial mistake which was how I was structuring the request to leverage gQL variable.

In case it’s helpful for others; below is a screenshot of the successful request.

  • Defining the variable within the gQL request
  • Defining the variable using WeWeb variable field

Thank you again, Mariano, for jumping in. I’m certain our paths will cross again. From your activity in the community, you’re clearly a WeWeb pro!


I’m happy that you solved it :slight_smile:

1 Like