0

I have a GraphQL mutation that creates an item and returns the data that's created. I need to pass some of the created fields into a query. Is this possible? This is almost working but I can't figure out how to get the data between the mutation and the query:

mutation {
    createToken(
        input: { tokenname: "my token", tokendescription: "my valuable token" }
    ) {
        id
        randomdata
    }
  insert__helloworld_article(objects: [{randomdata: "Hello" , author_id: 1}]) {
    returning {
      id
    }
  }
}

So my problem is getting "randomdata" from the mutation to insert into the helloworld_article

user1513388
  • 7,165
  • 14
  • 69
  • 111

1 Answers1

0

You wouldn't be able to use the return value in the same mutation with GraphQL, however if those objects have a relationship you could do a nested insert.

Arjun Yelamanchili
  • 577
  • 1
  • 3
  • 16