Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

200
Visualizações
Axios GET Request Scope with Pagination

so I've seen a few post about pagination with Axios, but what I've seen is primarily discussion around front-end. Effectively what I'm trying to do is use Axios to do a GET request, save my results and move on to the next pagingated request.

End goal is to take all requests and save them into a large .txt file.

Here is my problem so far. I have been able to make my first request and add the data result to a variable. However, the next call won't take the varaiable for the continuation parameter, because of the scope. I tried nesting it (see below) but it hasn't worked. I'm relatively new to Node.js and still don't fully understand promises but I'm willing to learn. If there is an answer to this somewhere already, please let me know. Otherwise, any help would be greatly appreciated.

Thank you

const axios = require('axios');
const eventBriteToken = '1234'
// Make a request for a user with a given ID
    axios.get('https://www.eventbriteapi.com/v3/organizations/12345/attendees', {
        params: {
            token: eventBriteToken,
        }
    })
    .then(function (response) {
      // handle success
      console.log(response.data.pagination.page_number)
      const continuationID = response.data.pagination.continuation 
      //console.log(response)
        axios.get('https://www.eventbriteapi.com/v3/organizations/12345/attendees', {
            params: {
                token: eventBriteToken,
                continuation: continuationID
            }
        })
        console.log(response.data.pagination.page_number)  
    })
    .catch(function (error) {
      // handle error
      //console.log(error);
    })
    .then(function () {
      // always executed
    });

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda