Solved

A requisição Graphql não retorna todos os cards do pipe

  • 28 March 2023
  • 1 reply
  • 175 views

Userlevel 4
Badge

Estou criando uma automação na qual eu preciso pegar todas as informações de todos os cards do pipe, porem a requisição não retorna todos os cards, segue a requisição:

 

 

query MyQuery {
  allCards(pipeId: "302991598") {
    edges {
      node {
        fields {
          name
          value
        }
        current_phase {
          name
        }
      }
    }
  }
}

icon

Best answer by Lais Laudari 28 March 2023, 20:19

View original

This topic has been closed for comments

1 reply

Userlevel 7
Badge +9

Olá @felipe-leite-matrixenergia!
Não são retornados todos os cards pois temos uma paginação. 😊 São 50 cards por pipe ou 30 por fase.
Para pegar todos os cards, você deve primeiro fazer essa query:
  {
    allCards(pipeId: 123456, first: 50) {
    pageInfo {
      hasNextPage
      endCursor
    }
    edges {
      node {
        id
      }
    }
  }
}
You will set the 
pageInfo
 attribute and it will return the "
endcursor
", with the endcursor you can see the other cards within that phase, putting it as an argument in the "
after
" command. Example:
E o 
hasNextPage
 vai te mostrar se existem mais páginas. Em seguida, pode usar o ID retornado pelo 
endCursor
 para pegar a próxima página:
{
allCards(pipeId:123456, first:50, after:"WyIyLjI1IiwiMTg1LjAiLDI2ODc1OTNd"){
pageInfo {
hasNextPage
endCursor
}
edges {
node {
id
}
}
}
}