Interacting with the GraphQL APIExecuting bulk mutations
Executing bulk mutations
Gato GraphQL provides "bulk" mutation fields for all mutations in the schema, allowing us to mutate multiple resources.
For instance, mutation createPosts
(single-resource mutation is createPost
) will create multiple posts:
Arguments
All bulk mutations accept two arguments:
inputs
(mandatory): The array of input items, where each item contains the data to mutate one resourcestopExecutingMutationItemsOnFirstError
(defaultfalse
): Indicate if, in case any of the inputs produces an error, should stop executing the mutation on the following inputs.
All mutations are executed in the same order provided in the inputs
argument.
Use cases
Bulk mutations unlock possibilities for managing our WordPress site.
For instance, the following GraphQL query uses createPosts
to duplicate posts: