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

112
Views
How can i catch the error when the api reaches its daily limit in JS?

I am trying to catch the specific error when a certain API key expires or it reaches its daily response limit(assuming 1000 per day).

const moviesearchEngine=()=>{
    let searchBox = document.querySelector('.searchBox');
    let movieTitle = document.querySelector('.movieTitle');
    let yearofRelease = document.querySelector('.yearofRelease');
    let genre = document.querySelector('.genre');
    let director = document.querySelector('.director');
    let plot = document.querySelector('.plot');

    const apiCall = ()=>{
        let params = new URLSearchParams({
            t:searchBox.value,
            apikey:`key`
        })
        let api = `http://www.omdbapi.com/?${params}`;

        //fetching the api orelse showing the error
        fetch(api).then((response)=>{
                return response.json();
        }).then((data)=>{
            //assigning the data to variable
            console.log(data)
        })
    }
    apiCall();
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You should try to read json response as it has different key and from one of them you can find the one who is responsible for setting limit. It is your api id key.

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!