Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

214
Visualizações
How to call this get api with sending the body using axios?

Hi I can call the the api in the postman like this.

The data return fine in the postman

Image

But when I try to get the api from the axios request the api always give me 500

What am I doing wrong?

axios
    .get('/dwapi/productsapi/GetProductList', {
      params: {
        group: 'Baby&Kids',
        subgroup: '',
        subsubgroup: '',
        pagesize: '',
        pagenum: '4',
        minprice: '',
        maxprice: '',
        brand: '',
        size: '',
        promotion: '',
        bhgexclusive: '',
        sortorder: '',
        sortby: '',
        search: '',
      },
    })
    .then(res => {
      console.log(res);
      // dispatch({
      //    type: FETCH_PRODUCT_LIST,
      //    payload: res.data,
      // });
    })
    .catch(err => {
      throw err;
    });
about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

axios
    .get('/dwapi/productsapi/GetProductList', {
        group: 'Baby&Kids',
        subgroup: '',
        subsubgroup: '',
        pagesize: '',
        pagenum: '4',
        minprice: '',
        maxprice: '',
        brand: '',
        size: '',
        promotion: '',
        bhgexclusive: '',
        sortorder: '',
        sortby: '',
        search: '',
      }
    )
    .then(res => {
      console.log(res);
      // dispatch({
      //    type: FETCH_PRODUCT_LIST,
      //    payload: res.data,
      // });
    })
    .catch(err => {
      throw err;
    });
about 4 years ago · Juan Pablo Isaza Relatório

0

It seems like you want to send your parameters in the body and not the URL parameters, thus you should not be specifying the params property:

axios
    .get('/dwapi/productsapi/GetProductList', {
      group: 'Baby&Kids',
      subgroup: '',
      subsubgroup: '',
      pagesize: '',
      pagenum: '4',
      minprice: '',
      maxprice: '',
      brand: '',
      size: '',
      promotion: '',
      bhgexclusive: '',
      sortorder: '',
      sortby: '',
      search: '',
    })
    .then(res => {
      console.log(res);
      // dispatch({
      //    type: FETCH_PRODUCT_LIST,
      //    payload: res.data,
      // });
    })
    .catch(err => {
      throw err;
    });
about 4 years ago · Juan Pablo Isaza Relatório

0

In axios, you can try with data instead of params. And let me know what will be the result.

axios
    .get('/dwapi/productsapi/GetProductList', {
      data: {
        group: 'Baby&Kids',
        subgroup: '',
        subsubgroup: '',
        pagesize: '',
        pagenum: '4',
        minprice: '',
        maxprice: '',
        brand: '',
        size: '',
        promotion: '',
        bhgexclusive: '',
        sortorder: '',
        sortby: '',
        search: '',
      },
    })
    .then(res => {
      console.log(res);
      // dispatch({
      //    type: FETCH_PRODUCT_LIST,
      //    payload: res.data,
      // });
    })
    .catch(err => {
      throw err;
    });
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda