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

162
Visualizações
Fetch data from Api in react

I want to fetch the data from this api (refer the screenshots) in reactjs using fetch function..I tried different ways but none of them is working

I am doing this way

useEffect(() => {
    // POST request using fetch inside useEffect React hook
    const requestOptions = {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify({ "firebase_id":"fonnnnjnvQXzyOcXK5kW88PM8jnjnhnhb1"})
    };
    fetch('demo.revon.com/audi/zero/li', requestOptions)
        .then(response => response.json())
        .then(data =>  console.log(data));                 
about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

requestOptions is not the issue here!


You are OBVIOUSLY hitting the localhost domain, not demo.revon.
Insert the full URL: https://demo.revon.com/audi/zero/li

about 4 years ago · Juan Pablo Isaza Relatório

0

You should try to call your API without https://localhost:3000 in front of your API link.

You forgot to put HTTP or HTTPS so it consider a subfolder of localhost:3000.

You must do something like that : (or http if not https)

fetch('https://demo.revon.com/audi/zero/li', requestOptions)
        .then(response => response.json())
        .then(data =>  console.log(data));    

Regards

about 4 years ago · Juan Pablo Isaza Relatório

0

You’ll need to mention https:// in the fetch url

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