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

620
Views
How do you resolve: The parameters (String) don't match the method signature for ScriptApp.getOAuthToken in Google Apps Script?

I'm trying to get information from a squareup api into Google Sheets, but I'm not quite sure how to deal with the bearer token and misalignment with the ScriptApp method signature. Thank you!

 function squareLocations() {

  var url = "https://connect.squareup.com/v2/locations";
  var headers = {
                "Square-Version": "2022-01-20",
                "Authorization": token,
                "Content-Type": 'application/json'
                }
  var data =    { 
                'locations': {
                  'id': locationID,
                  'name': locationName,
                  'address': locationAdress,
                             }
                }
  const params = {
    headers: head,
    method: "get",
    muteHttpExceptions: true,
    payload: JSON.stringify(data)
    }
    
  var response = UrlFetchApp.fetch(url, headers);
  
  var responseCode = response.getResponseCode();
  var responseBody = JSON.parse(response.getContextText());
  var json = JSON.parse(responseBody);
  if (responseCode === 200)
    {
        responseJSON.error = false;
        return responseJSON;
    }
    else
    {
        responseJSON.error = true;
        responseJSON.message = `Request failed. Expected 200, got ${responseCode}: ${responseBody}`;
        return responseJSON;
    }
  
  
  }
about 4 years ago · Juan Pablo Isaza
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!