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

258
Vistas
axios multipe param request

I'm trying to make a query with axios and parameters When I perform this code:

axios.get('/myApi', { params: { id: [1,2,3] })

This puts all in the same url

http://localhost/api/myApi?id[]=1&id[]=2&id[]=3

Is there a possibility that I will get a different request each time knowing that my input table will be dynamic?

I would like this dynamically:

http://localhost/api/myApi?id[]=1
http://localhost/api/myApi?id[]=3
http://localhost/api/myApi?id[]=3
...

thanks in advance

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

No but you can loop through that url params and request it using axios like :-

for (let i = 0; i < id.length; i++) {
  axios.get('/myApi', { params: { id: [i] })
}
about 4 years ago · Juan Pablo Isaza Denunciar

0

No you have to do that yourself, by issuing multpile requests.

You can utelize Promise.all and map for that.

map is used to issue the individual requests for the passed ids, and to store the Promises returned by axios in an array. And Promise.all to wait for all of them to resolve.

function batchRequest(ids) {
   return Promise.all(ids.map( id => {
      return axios.get('/myApi', { params: { id: [id] }})
   }))
}

about 4 years ago · Juan Pablo Isaza Denunciar
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