Solved

How do I get and insert data to a table via Postman?

  • 15 June 2022
  • 3 replies
  • 249 views

Userlevel 2

Hi all,

 

How can I find a simple example of how to search table data and to insert data into a custom table with columns like: “Title”, “First Name”, “Last Name” and “E-mail”. I am trying that using Postman, but the only response I got was Bad Request. Is there any link or tutorial explaining how to achieve that?

 

Thanks! 

icon

Best answer by rafael-pitanga 15 June 2022, 23:45

View original

3 replies

Userlevel 2

I managed to insert with this:

mutation{
createTableRecord(
input: {
table_id: "table id",
title: "Teste (colaboradores)",
fields_attributes: [
{field_id: "email_pessoal", field_value: "[email protected]"},
{field_id: "nome_completo", field_value: "nome completo"},
{field_id: "matr_cula", field_value: "12345"}]
}
)
{
table_record { id }
}
}

I just don't know how to add multiple records at once. 

Userlevel 7
Badge +8

Perfect, @rafael-pitanga 

Do you need more help on that?

Userlevel 7
Badge +8

To insert more than one record at once, you can use multiple queries in the same request. An example would be:

mutation{
N0 createTableRecord(
input: {
table_id: "table id",
title: "Teste (colaboradores)",
fields_attributes: [
{field_id: "email_pessoal", field_value: "[email protected]"},
{field_id: "nome_completo", field_value: "nome completo"},
{field_id: "matr_cula", field_value: "12345"}]
}
)
{
table_record { id }
}
N1 createTableRecord(
input: {
table_id: "table id",
title: "Teste2 (colaboradores)",
fields_attributes: [
{field_id: "email_pessoal", field_value: "[email protected]"},
{field_id: "nome_completo", field_value: "nome completo2"},
{field_id: "matr_cula", field_value: "6789"}]
}
)
{
table_record { id }
}
}

for two at once. The “N0” and “N1” can be any alphanumeric string (or not even there) and would allow you to associate the results with the queries/mutations.

 

Note that there is a certain limit to the nr of queries and/or mutations you can make at once, somewhere around 30 I belive.

Reply