Sticky F.A.Q.

API Pagination

  • 28 September 2023
  • 3 replies
  • 350 views
API Pagination
Userlevel 7

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
        }
      }
    }
  }



 

 

 


3 replies

Hello Lais!

That’s very usefull! 

How can I know which queries needs pagination?

I’m fetching the user roles data from multiples pipes. Its pagination needed?

Help me with this, please.

Thanks

Userlevel 7

Hi @leonardo-mendonca!
Pagination will be required when performing queries that result in cards or records from pipe/phases or databases, with a limit of 50 cards/records per pipe or 30 cards per phase.

Understood! Thank you so much!

Reply