Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

162
Vistas
GraphQL result for another mutation

Is it meanwhile possible to use the result of a GraphQL mutation as a parameter for another mutation?

I would like to create a user and his address together in one call.

First I write the address and then take the address id for the creation of the user. Filling the necessary data via the inputs works perfectly

Is this possible without triggering a new mutation from the client?

const createUser = gql`
  mutation createUser(
    $user: createUserInput!
    $address: createAddressInput!
  ) {
    createAddress(input: $address) {
      address {
        id       
      }
    }
    createUser(input: $user ) {
      user {
        id
        username
      }
    }
  }
`
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

No, this is not possible. You either have to make two sequential requests from the client, or adapt your server implementation. I recommend the latter.

You should change your schema so that the CreateUserInput type to not only accepts an addressId: ID but alternatively can accept a newAddress: CreateAddressInput object, which it will then use to create a new address before creating a new user.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda