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

224
Vistas
How to correctly pass array params to API call

I'm stuck with passing params to my API call. There is API call for getting companies in search. And some filters which I pass as params to axios get query. Problem with income param which looks like this income: ["$100K - $124K"] On API this call looks like this:

companies?page=1&limit=12&income=%24100K%20-%20%24124K

But in my case:

companies?page=1&limit=12&income=[]=$100K+-+$124K

and I'm getting wrong response with that.

Here code of my API call:

export const getCompanies = ({page, limit, query, ...rest}: {page: number, limit: number, query?: string}): Promise<AxiosResponse<{items: Company[], meta: Meta}>> => {
    return http.get('companies', {
        params: {
            page,
            limit,
            q: query,
            ...rest
        }
    })
}

income param comes with ...rest (and this is actually correct because every other filter-param works well except that one)

By the way, I wouldn't mind if you rate my idea of passing params as ...rest (I'm not confident about that)

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