Data & Functions
Pass user input into a GraphQL API

Pass user input into a GraphQL API call


You have user input from a UI component that needs to be used in a GraphQL API call.


To pass user input from the client to a GraphQL API request use GraphQL variables and interpolation.

  1. Add the UI component on your Page or Component (e.g. an Input named input)
  2. Create a new Page Function and select Make a GraphQL Request
  3. Jump to the GraphQL Resource by clicking the > next to the resource name, and configure your Base URL and Headers
  4. Enter the Query for the request and include a GraphQL $variableName:
query MyQuery($variableName: String!) {
	// ... rest of GraphQL query, using $variableName
  1. Enter the following in variables to bind the input value to the $variableName:
	variableName: {{ input.value }}
  1. Save and test your function


See also