Cant figure out this simple pagination in my custom app

In this simple get function cannot find out why the pagination isn’t working.

{
    "url": "/agenda/lista", // Endpoint para retornar a lista de agendamentos
    "method": "GET", // Método HTTP GET
    "headers": {
        "Content-Type": "application/json" // Cabeçalho indicando JSON como formato de dados
    },
    "qs": {
        "codigoPaciente": "{{parameters.codigoPaciente}}", // Código do paciente (opcional)
        "codigoPessoaExecutor": "{{parameters.codigoPessoaExecutor}}", // Código do executor (opcional)
        "dataInicial": "{{formatDate(parameters.dataInicial,'YYYY-MM-DD')}}", // Data final (obrigatório)
        "dataFinal": "{{formatDate(parameters.dataFinal,'YYYY-MM-DD')}}", // Data inicial (obrigatório)
        "dataPor": "{{parameters.dataPor}}",
        "registrosPorPagina": "{{parameters.registrosPorPagina}}"
    },

    "response": {
        "output": "{{body}}"
    // Retorna o corpo da resposta da API como saída
    },
    "pagination": {
        "qs": {
            "pagina": "{{pagination.page}}"
        },
        "condition": "{{body.totalPaginas >= pagination.page}}"

    }
}

“pagina” is equal the page that a need to pass
“totalPaginas” is the total of pages.

It seem that the the argument are not passed to the call. And i dont now why

1 Like

Hello @Davi_CNN !

I believe pagination only works with iterated responses. I see you are using a Search module type. You need to iterate the responses so that Make knows to expect many items. Like this:

"response": {
	"iterate": "{{body.lista}}",       
	"output": "{{item}}",
	"limit": "{{parameters.limit}}"
}

Don’t forget to create a “limit” parameter to avoid using up all your operations!

Here is the documentation on this: Make.com - Custom App Documentation

Your pagination may work after that.

Please tell us if it works, because this could help other users.

Good luck with your custom app!

Regards, Terry.

1 Like

Awesome Terry, u really helped

2 Likes

Hi @Davi_CNN .

Excellent! Happy to help.

Please could you mark my answer as the solution if it solved your original question, because this will help future users having the same problem.

Good luck with your custom app!

Regards, Terry.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.