I have used Postman and Charles to see if my Smartsheet GET function works, and all is well, I get the data json string back.
I have tried running the call from local code and from a Google app script html page.
But I get this error from the Google app script page:
"XMLHttpRequest cannot load https://api.smartsheet.com/2.0/sheets/ MY SMART SHEET ID. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://n-n662xy6uqbadudjpoghatx4igmurid667k365ni-script.googleusercontent.com' is therefore not allowed access."
It is my aim to update a Google sheet automatically from a Smartsheet sheet.
My Ajax request looks like this:
var settings = {
"async": true,
"crossDomain": true,
"url": "https://api.smartsheet.com/2.0/sheets/SHEET_ID",
"method": "GET",
"headers": {
"authorization": "Bearer MY_SECRET_ACCESS_TOKEN",
"cache-control": "no-cache",
"postman-token": "SOME_LONG_TOKEN"
}
}
$.ajax(settings).done(function (response) {
console.log(response);
});