New GraphQL API update: Batch field updates for Cards and Database Records

  • 6 April 2021
  • 6 replies
  • 1154 views
New GraphQL API update: Batch field updates for Cards and Database Records
Userlevel 7
Badge +8

We released a new API mutation called 

updateFieldsValues

 that will allow users to update up to 30 fields in a single API call. This new mutation will improve the overall developer experience when handling batch updates and will significantly improve the speed of batch updates, by reducing the number of API calls.

 

📌 Incremental updates

This new API mutation also allows developers to update fields that contain multiple data by just adding a new value or removing an existing value.
For example, to add a label to a label field, previously developers would need to do two API calls, an API call to get all existing labels, use this list to append the new label and then send to Pipefy in another API call the new list of all the labels. With the new mutation updateFieldsValues, developers can send an API mutation telling Pipefy to only add a new label to the existing list of labels in a​ field, the same applies to assignees, connections and checklists fields.

 

Sample GraphQL mutation

Updating two fields of a Card, replacing the 

what_s_your_name

 value and adding a new assignee to the 

who_s_responsible_for_approving

 assignee field.

 

 

You can check the GraphQL specification of the new mutation here. 


6 replies

Userlevel 7
Badge +12

I already use that, it is super useful!

Userlevel 3
Badge

@Juliana Spinardi 

Muito obrigada! Estou utilizando e é muito mais rápido do que fazer pelo pipe.

Mas gostaria de saber se existe alguma forma de atualizar os campos de mais de um card em uma mesma execução? Eu tentei colocar no formato abaixo, por exemplo, mas o só rodou o nodeId “413218091”.

 

mutation {
  updateFieldsValues(input: {
nodeId: 381811217
    values: [
      { fieldId: "o_qu" value: "NUBANK" },
      { fieldId: "nome" value: "Marketing - Nubank" },
    ]
nodeId: 46392442
    values: [
      { fieldId: "o_qu" value: "TECHNIP-FMC" },
      { fieldId: "nome" value: " Suprimentos - TECHNIP-FMC" },
    ]
nodeId: 374394312
    values: [
      { fieldId: "o_qu" value: "ELDORADO BRASIL" },
      { fieldId: "nome" value: " Erika Passos Hatori - ELDORADO BRASIL" },
    ]
nodeId: 413218091
    values: [
      { fieldId: "o_qu" value: "ATACADÃO" },
      { fieldId: "nome" value: "ADEMIR NERIS DOS SANTOS - ATACADÃO - ATACADÃO" },
    ]

  }) {
    success
    userErrors { field message }
    updatedNode {
      ... on Card {
        id
        fields {
          name
          value
        }
      }
    }
  }
}

Userlevel 7
Badge +12

Hi @Janaina_Barreto 

 

To update multiple card at once, you can use the following format (where the three dots, …, are equivalent to the respective rest of your queries, and the clientMutationId can of course be replaced by all the other fields you want to query):

 

mutation {
N0 :updateFieldValues( input: { nodeId: "9013401", ... } ){ clientMutationId }
N1 :updateFieldValues( input: { nodeId: "93345190", ... } ){ clientMutationId }
N2 :updateFieldValues( input: { nodeId: "9342891", ... } ){ clientMutationId }
}

 

N0 to N2 can be replaced by some other alphanumeric identifier you would like to use to distinguish the different queries, and of course more or less than three are possible.

 

Please open a new thread for your question next time such that answers can be accepted.

Userlevel 3
Badge

@genietim Thank you so much! I’ve been wanting to do this for a long time!

I appreciate your feedback and next time i’ll make sure to open a new thread. :grin:

Userlevel 3

Hey guys,

 

Does

“update up to 30 fields in a single API call”

apply to every card or to all cards in a multiple card mutation?

 

thanks

Bernardo

Hi @Janaina_Barreto 

 

To update multiple card at once, you can use the following format (where the three dots, …, are equivalent to the respective rest of your queries, and the clientMutationId can of course be replaced by all the other fields you want to query):

 

mutation {
N0 :updateFieldValues( input: { nodeId: "9013401", ... } ){ clientMutationId }
N1 :updateFieldValues( input: { nodeId: "93345190", ... } ){ clientMutationId }
N2 :updateFieldValues( input: { nodeId: "9342891", ... } ){ clientMutationId }
}

 

N0 to N2 can be replaced by some other alphanumeric identifier you would like to use to distinguish the different queries, and of course more or less than three are possible.

 

Please open a new thread for your question next time such that answers can be accepted.

 

Is there any limitation of the amount of cards I can update in the same requisition?

Reply