Skip to content

Unable to use environment variables in request body (GraphQL) #2886

Closed

Description

@MoshePaul

Is there a way to use variables for your environment inside the body of a GraphQL query? For example:

query { assignRole(roleId: my_role, account: my_account) { data { id} } }

Activity

  1. koldoon commented on Dec 3, 2020

    @koldoon

    You must use query variables. It is a little bit overcomplicated but works well:

    query ($itemId: String!) {
      item(itemId: $itemId) {
        name
      }
    }
    

    Query Variables:

    {
      "itemId": "{{ _.itemId }}"
    }
    
  2. jostFT commented on Jan 15, 2021

    @jostFT

    This won't work if you are working with numeric values. Please refer to the open issue:
    #1937
    This issue has existed for a long time, and has yet to be addressed by the devs - so who knows when this will be fixed

  3. stale commented on May 27, 2021

    @stale

    This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

  4. locked and limited conversation to collaborators on Jun 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions