Solved

How to get all cards from phase?


Userlevel 2

How to get all cards from phase? And if the phase has more 50 cards, what i have to do?

icon

Best answer by marcos.pedrosa 26 September 2022, 02:30

View original

11 replies

Userlevel 7
Badge +5

Hello how are you? Do you want to move all these cards? If so, you can create an automation to move all those cards to the next stage. If you don't know how to create an automation, take a look at this article:
https://help.pipefy.com/pt-BR/articles/3675228-como-crio-uma-automacao-para-mover-cards

Userlevel 2

Hello Rafel,

I didn't explain it correctly, I'd like to get all the info for the cards of a specific phase through the api.
Userlevel 7
Badge +4

Hello @karmendes if the pipe have more than 50 cards tou should add the request pageInfo to the query, so answer will send a code that you could add as a param(after: ) to the request to start from there.

Ex: 

{
allCards(pipeId:**********) {
edges {
node {
id
}
}
pageInfo {
endCursor
startCursor
}}

}

Than:

{
allCards(pipeId:*********, after:"abcde") {
edges {
node {
id
}
}
pageInfo {
endCursor
startCursor
}}

}

 

Userlevel 7
Badge +8

@karmendes did you get the answer you needed?

Userlevel 2

Not Exactly, but i have other problem now.

Userlevel 7
Badge +4

Not Exactly, but i have other problem now.

How can i help you?

Userlevel 2

I am searching for all cards from specific phase from pipe, but my call to api when i pass pageInfo(endCursor) i have a error.

query
payload_test = {"query": "{phase(id:xxxxx,after:'xxx'){name cards_count cards {edges {node {age}}pageInfo {endCursor hasNextPage}}}}"}

I receive
{'errors': [{'message': 'Parse error on "\'" (error) at [1, 27]', 'locations': [{'line': 1, 'column': 27}]}]}

Userlevel 7
Badge +4

I am searching for all cards from specific phase from pipe, but my call to api when i pass pageInfo(endCursor) i have a error.

query
payload_test = {"query": "{phase(id:xxxxx,after:'xxx'){name cards_count cards {edges {node {age}}pageInfo {endCursor hasNextPage}}}}"}

I receive
{'errors': [{'message': 'Parse error on "\'" (error) at [1, 27]', 'locations': [{'line': 1, 'column': 27}]}]}

Maybe its beacuse you dont need this text at the start, you can run the query from the {phase...

Userlevel 7
Badge +4

I am searching for all cards from specific phase from pipe, but my call to api when i pass pageInfo(endCursor) i have a error.

query
payload_test = {"query": "{phase(id:xxxxx,after:'xxx'){name cards_count cards {edges {node {age}}pageInfo {endCursor hasNextPage}}}}"}

I receive
{'errors': [{'message': 'Parse error on "\'" (error) at [1, 27]', 'locations': [{'line': 1, 'column': 27}]}]}

Maybe its beacuse you dont need this text at the start, you can run the query from the {phase...

Like this 

 

I’m stuck on same problem.

I tried to get all cards from one unique phase and it doesn’t return all of them.

Using the code below I’ll need to request every single card to get its phase information, then I will be able to use them.

"""{
allCards(pipeId: xxxx) {
edges {
node {
id
}
}
pageInfo {
endCursor
startCursor
}}}"""

I tried to get all cards using “phaseId”, “pipeId, phaseId“ but it’s not a valid argument, tried getting pageInfo on code below and doesn’t work too.

{ phase(id: 12345){ id name cards_count fields { id label } cards{ edges{ node{ id } } } } }

I need to get absolutelly all cards from a single phase, the most efficient way (it’s ok to make a request for each 30 cards, but with the information I can get from here and the documentation it looks like I’ll need to make a request to each card to get it phase). 

Userlevel 6
Badge

Hello Renato and team, 
in order to show all cards form a phase, you can use the query below:

query{
  phase(id:XXXXXX){
    cards{
      edges{
        node{
          id
          title
        }
      }
    }
  }
}

The current limit of cards/records shown is 30 cards per phase and 50 cards per pipe. Since our  API has pagination in place, you’ll need to use the following example in order to list all the cards.

  {
    allCards(pipeId: 123456, first: 50) {
    pageInfo {
      hasNextPage
      endCursor
    }
    edges {
      node {
        id
      }
    }
  }
}

You will set thepageInfo 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:
 

{
allCards(pipeId:123456, first:50, after:"WyIyLjI1IiwiMTg1LjAiLDI2ODc1OTNd"){
pageInfo {
hasNextPage
endCursor
}
edges {
node {
id
}
}
}
}

Hope that helps 😃

Reply