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

107
Views
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 answers
Answer question

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