Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

206
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda