Skip to main content
Question

Can't retrieve alls cards from a pipe


miguel-rodolpho

Hello everyone.

 

I am trying to obtain all the cards from a pipe using the following query/code:

 

pagina = true

    while pagina == True:

       

        # Define quais informações serão extraídas dos cards do pipe

        query = """

            {

                allCards(pipeId: %s, first: 50, after: "%s") {

                pageInfo {

                    hasNextPage

                    endCursor

                }

                    edges {

                        node {

                            id

                            current_phase {

                                name

                            }

                            done

                            fields {

                                name

                                value

                            }

                        }

                        cursor

                    }

                }

            }

        """ % (pipe_id, endCursor if endCursor else "")

 

        response = requests.post(pipefy_url, json={'query': query}, headers=pipefy_headers)

        if response.status_code == 200:

            dados_resposta = response.json()

 

            endCursor = dados_resposta['data']['allCards']['pageInfo']['endCursor']

 

            pagina = dados_resposta['data']['allCards']['pageInfo']['hasNextPage']

            if pagina == False:

                break

 

            time.sleep(0.5)

 

        else:

            print(f"Erro na requisição: {response.status_code}, {response.text}")

 

Right now, it returns data from 2313 cards. However, I noticed some records are not being retrieved by this request (the pipe has a total of 2363 cards). Does anyone know why? 

Also, suppose I need to retrieve the cards that are currently on the “Mailing” phase. Is it possible to use filters inside the query to obtain only the data from those cards? I already tried using the following, but didn’t work:

 

allCards(pipeId: %s, first: 50, after: "%s", filter: {field: "current_phase", value: "Mailing"})

 

Thanks for your help!

Reply


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