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

154
Vistas
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 Respuestas
Responde la pregunta

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 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