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

110
Vistas
wordsAPI fetch returns 200 status with no data javascript

I have just subbed to wordsAPI https://www.wordsapi.com/

and pasted the code to fetch data straight from their Docs:

const getDefinition = async (text) => {
    try {
        const res = await fetch(`https://wordsapiv1.p.rapidapi.com/words/${text}/definitions`, {
            "method": "GET",
            "headers": {
                "x-rapidapi-host": "wordsapiv1.p.rapidapi.com",
                "x-rapidapi-key": "MYAPIKEY"
            }
        })
        console.log(res)
    } catch (err) {
        console.log(err)
    }
}

the response object looks as such:

body: (...)
bodyUsed: false
headers: Headers {}
ok: true
redirected: false
status: 200
statusText: "OK"
type: "cors"
url: "https://wordsapiv1.p.rapidapi.com/words/something/synonyms"
[[Prototype]]: Response

I get back a 200 but the response has no data?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You should use res.json() to fetch data:

const getDefinition = async (text) => {
try {
    const res = await fetch(`https://wordsapiv1.p.rapidapi.com/words/${text}/definitions`, {
        "method": "GET",
        "headers": {
            "x-rapidapi-host": "wordsapiv1.p.rapidapi.com",
            "x-rapidapi-key": "MYAPIKEY"
        }
    })
    const mainData = await res.json();
    console.log(mainData)
} catch (err) {
    console.log(err)
    }
}  
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