I'm trying to test my apps script doPost function, with postman. so far I have:
function doPost(e) {
var id = '1L_U7MhmV............................'
SpreadsheetApp.openById(id).getSheetByName('responses').appendRow([new Date()]);
var params = JSON.stringify(e.parameter);
return ContentService.createTextOutput(JSON.stringify(e.parameter));
}
I can get it working with the /exec string but when I try the /dev string I can't. I'm getting a 500 error. I'm logged into my account and have updated the version number under publish. How can I get this working?
EDIT:
Thank you. I'm trying to option 1. I created a function that logs the oath token:
function getOAuthToken1() {
Logger.log('Current project has ' + ScriptApp.getOAuthToken());
}
- I ran it and got the token. Then inserted it into
https://script.google.com/macros/s/ACCESSTOKEN/dev
but posting to this produces:
Sorry, the file you have requested does not exist.
EDIT2:
https://script.google.com/macros/s/###/dev
, please include the access token, even if you set "Who has access to the app: Anyone, even anonymous". Although I cannot find the document about this, I think that this is the specification. - TanaikeScriptApp.getOAuthToken()
at Google Apps Script. You can use the retrieved access token. But the expiration time is 1 hour. So when the expiration time is over, it is required to retrieve it again. But in the case that it is used as the test run, I think that this can be also used. If the scope error occurred, please add the required scopes. - Tanaike