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

175
Views
Axios get request from url

So I'm having an issue with the npm package axios when trying to make a get request to a URL. I get an error code 503 every time; this is my code:

let data, response;

response = await axios.get(url, {
    headers: {
        Accept: 'application/json',
    }
})

So at first, I thought I did something wrong with the code (like changing Accept to 'Accept'), but when I do the exact same thing on Postman, it returns just fine.

about 4 years ago · Santiago Gelvez
1 answers
Answer question

0

So I tried by changing the User-Agent option in the headers to the one from Postman, and now it just seems to be working.

let data, response;

response = await axios.get(url, {
    headers: {
        'Accept': 'application/json',
        'User-Agent': 'PostmanRuntime/7.28.4',
    }
});

I'm still a bit new to http requests, so I really don't understand how this happens. I'm using axios in other cases with different URL's too and there everything just runs fine.

about 4 years ago · Santiago Gelvez Report
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!