Created
November 18, 2021 15:40
-
-
Save wendeehsu/e1318e28cf659e9701488d378a40b263 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getReviews(locationId = 'YOUR_LOCATION_ID') { | |
var service = getService(); | |
if (service.hasAccess()) { | |
var url = 'https://mybusiness.googleapis.com/v4/accounts/'+ accountId +'/locations/'+locationId+'/reviews'; | |
Logger.log(url); | |
var response = UrlFetchApp.fetch(url, { | |
headers: { | |
Authorization: 'Bearer ' + service.getAccessToken() | |
} | |
}); | |
var result = JSON.parse(response.getContentText()); | |
Logger.log(JSON.stringify(result, null, 2)); | |
} else { | |
var authorizationUrl = service.getAuthorizationUrl(); | |
Logger.log('Open the following URL and re-run the script: %s', authorizationUrl); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment