Skip to main content
StickyF.A.Q.

API Reference > Database

  • November 24, 2023
  • 2 replies
  • 306 views
API Reference > Database
Lais Laudari

Do you need help with your API queries and/or mutation?

Here are a few that might help you!😉

 

🔎Queries

📍 GET TABLE RECORDS WITH PAGINATION - TABLE ID

{
  table_records(first: 10, table_id: "XXXXXXX") {
    edges {
      cursor
      node {
        id
        title
        url
      }
    }
    pageInfo {
      endCursor
      hasNextPage
      hasPreviousPage
      startCursor
    }
  }
}

📍 GET TABLE RECORDS  -  TABLE RECORD ID
{
  table_record(id: XXX) {
    assignees {
      id
      name
    }
    created_at
    created_by {
      id
      name
    }
    due_date
    finished_at
    id
    labels {
      id
      name
    }
    parent_relations {
      name
      source_type
    }
    record_fields {
      array_value
      date_value
      datetime_value
      filled_at
      float_value
      name
      required
      updated_at
      value
    }
    summary {
      title
      value
    }
    table {
      id
    }
    title
    updated_at
    url
  }
}

📍 FIND TABLE RECORDS  -  FIELD ID | FIELD VALUE
{
  findRecords(tableId:"xxxx", first: 50, search:{fieldId:"xxx", fieldValue:"xxxx"}){
    edges{
      node{
        title
        id
      }
    }
  }
}
 

🛠Mutations

📍CREATE TABLE RECORD

mutation {
  createTableRecord(
    input: {
      table_id: "xxxxx"
      title: "my record"
      due_date: "2017-12-31T00:00-03:00"
      fields_attributes: [
        { field_id: "first_name", field_value: "Tom" },
        { field_id: "last_name", field_value: "Trindade" },
        { field_id: "email", field_value: "tom@trindade.com" }
      ]
    }
  ) {
    table_record {
      id
      title
      due_date
      record_fields {
        name
        value
      }
    }
  }
}


📍CREATE TABLE FIELD

 {
  createTableField(
    input: {
      table_id: "xxx"
      type: "radio_vertical"
      label: "Gender"
      options: ["Female", "Male"]
      description: "Select your gender"
      help: ""
      required: true
      minimal_view: false
      custom_validation: ""
    }
  ) {
    table_field {
      id
      label
      type
      options
      description
      help
      required
      minimal_view
      custom_validation
    }
  }
}
 

📍UPDATE TABLE RECORD
mutation {
  updateTableRecord(
    input: {
      id: "xxxx"
      title: "My custom title"
      due_date: "2017-07-31T00:00-05:00"
    }
  ) {
    table_record {
      id
      title
      due_date
      record_fields {
        name
        value
      }
    }
  }
}

📍SET TABLE RECORD FIELD VALUE

mutation {
  setTableRecordFieldValue(
    input: {
      table_record_id: "xxx"
      field_id: "first_name"
      value: "Theo"
    }
  ) {
    table_record {
      id
      title
    }
    table_record_field {
      value
    }
  }
}

📍DELETE TABLE RECORD

mutation {
  deleteTableRecord(input: {id: "xxxx"}) {
    success
  }
}

📍MUTIPLES CREATE TABLE RECORD

mutation {
  record1: createTableRecord(input: {
    table_id: "xxxx",
    fields_attributes: [
      {field_id: "xxxx", field_value: "xxxx"}
    ]}) {
    table_record {
      id
    }
  }
  n2: createTableRecord(input: {
    table_id: "xxxx",
    fields_attributes: [
      {field_id: "xxxx", field_value: "xxxx"}
    ]}) {
    table_record {
      id
    }
  }
}
 

📍UPDATE STATUS FIELD

First you need to know the status ID
{
  table(id:"xxxx"){
    statuses{
      name
      id
    }
  }
}


After that you can do the action
mutation {
  updateTableRecord(input: {statusId: xxx, id: xxx}) {
    table_record {
      title
      status {
        name
      }
    }
  }
}


 

Did this topic help you find an answer to your question?

2 replies

marcosmelo
Forum|alt.badge.img+18
  • Pipefy Legend
  • 1465 replies
  • November 24, 2023

Very good!


Ezequiel Souza
Forum|alt.badge.img+14

Great! Thanks for sharing


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings