• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

287
Views
Why does urlfetch() give me "Service invoked too many times for one day" in this context using GAS to get API data?

I've been trying to get all candidates from Catsone into a Google Sheet and although the code is apparently according to their API instruction, I'm getting the above mentioned error and I'm not sure where to look for the issue.

Here's the code I'm running:

const API_KEY = "XXXXXXXXXXXXXXXXXXXXXXXX";

function getallcandidates() {
  const url = 'https://api.catsone.com/v3/candidates';
  const params = {
    'muteHttpExceptions': true,
    'method': 'GET',
    'headers': {
      'Content-Type': 'application/json',
      'Authorization': 'Token' + API_KEY
    }
  };

  const response = UrlFetchApp.fetch(url, params);
  const data = response.getContentText();
  const json = JSON.parse(data);
  Logger.log('Data: ' + json)
}

These are their instructions for authentication: https://docs.catsone.com/api/v3/#authentication

This is what successfully I got whe I tried calling it from Postman:

var myHeaders = new Headers();
myHeaders.append("Authorization", "Token XXXXXXXXXXXXXXXXXXXX");

var requestOptions = {
  method: 'GET',
  headers: myHeaders,
  redirect: 'follow'
};

fetch("https://api.catsone.com/v3/candidates", requestOptions)
  .then(response => response.text())
  .then(result => console.log(result))
  .catch(error => console.log('error', error));

Appreciate any help.

about 3 years ago · Juan Pablo Isaza
1 answers
Answer question

0

When I saw your added Javascript and your Google Apps Script, if the value of const API_KEY = "XXXXXXXXXXXXXXXXXXXXXXXX"; has no space at the top character, how about the following modification?

Modified script:

From:

'Authorization': 'Token' + API_KEY

To:

'Authorization': 'Token ' + API_KEY
  • From your additional Javascript, 'Token' is modified to 'Token '.
about 3 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 Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error