Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

225
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!