Is it possible to query the same field multiple times with graphql

Yes, this is possible, but not in this form. GraphQL server will reject such query as a field with the same name used multiple times, but with different arguments.

You need to use aliases:

query {
  item1: myItem(size: 100, type: 2) {
    id,
    name
  }
  item2: myItem(size: 150, type: 2) {
    id,
    name
  }
  item3: myItem(size: 10, type: 1) {
    id,
    name
  }
}

You can find more info on aliases here:

http://graphql.org/learn/queries/#aliases

Leave a Comment