API queries to dense databases could potentially return millions, if not billions, of results. Pagination thus helps to limit the number of results. It’s a process used to divide a large dataset into smaller chunks (pages).
Pipefy API endpoint supports pagination with a limit of 50 cards/records per pipe or 30 cards per phase.
Here are two examples of how to use pagination:
Example 1 > query allCards
{
allCards(pipeId: xxxx, 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. And hasNextPage will show you if there are more pages. You can then use the ID returned by the endCursor to get to the next page:
{
allCards(pipeId:XXXXX, first:50, after:"WyIyLjI1IiwiMTg1LjAiLDI2ODc1OTNd"){
pageInfo {
hasNextPage
endCursor
}
edges {
node {
id
}
}
}
}
Example 2 > query findCards/Records
{
findCards(pipeId: XXXXX, search:{fieldId:"qual_o_tipo_de_camp" fieldValue:"Valor"}){
edges{
node{
id
fields {
name
value
}
}
}
}
}
The field value attribute must pass all the content that is in the field, the same way it is written because it is case sensitive.
The field type ID from the card does not work as a filter in this query.
⚠️ The field connection is not available to filter yet.
_______________________________________________________________________________________________
{
findRecords(tableId:"suid", search:{fieldId:"meu_campo", fieldValue:"Valor"}) {
edges {
node {
id
fields {
name
value
}
}
}
}