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

152
Views
problem with axios get error 400 bad request

I have been stuck for quite a while because when I launch a call to my API to retrieve data (therefore a GET method) I have a 400 bad request error off on postman I manage to retrieve the data in status 200. However in my axios I pass the parameters well as well as the useful headers.

Code axios status 400 :

async getAssociatedPlant() {                
                this.$axios.$get('lnk/plant/plants', {
                    headers: {
                        "Content-Type": "application/json",
                    },
                    params: {
                        link: "good",
                        plant_id: this.plantActive.id,
                    },
                    
                })
                    .then(response => {
                        console.log(response) 
                    }).catch(error => {
                        console.log(error)
                    });
            },

Image useful for understanding :

Postman Headers status 200 OK

Postman Params status 200 OK

Erreur 400 bad request

Request Payload

Request Response

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Try adding data:{} to your request config.

async getAssociatedPlant() {
    this.$axios.$get('lnk/plant/plants', {
        headers: {
            "Content-Type": "application/json",
        },
        data:{},
        params: {
            link: "good",
            plant_id: this.plantActive.id,
        },

    })
        .then(response => {
            console.log(response)
        }).catch(error => {
            console.log(error)
        });
}
about 4 years ago · Juan Pablo Isaza 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!