问题
Trying to use Execution API for one of my project with devMode: true
, but getting the following error. But it works flawlessly when I make devMode: false
.
NOTE: I am owner and using the API from same account (so it should work ideally)
- I have deployed the script as api executable with access as "Anyone"
- I have enabled the "Apps Script API" in the developer console
- Both the oauth and apps script share the same project
{
"error": {
"code": 404,
"message": "Requested entity was not found.",
"status": "NOT_FOUND"
}
}
回答1:
I had also experienced the same situation. So can you confirm the following points again?
- Save the apps script using the save button again.
- Save the apps script as a new version.
- Whether the client ID and client secret are retrieved from the project that Apps Script API is used.
- Whether the access token is retrieved from these client ID and client secret.
- Whether the scope inclues
https://www.googleapis.com/auth/drive
,https://www.googleapis.com/auth/drive.scripts
andhttps://www.googleapis.com/auth/script.external_request
.
After I confirmed above again, I always test using a following curl command. When you use this curl command, please input your access token, function name and script ID.
curl -X POST -L \
-H "Authorization: Bearer ### access token ###" \
-H "Content-Type: application/json" \
-d "{function: '### function name ###',devMode: true}" \
"https://script.googleapis.com/v1/scripts/### script ID ###:run"
In my environment, the error in your question was solved. I don't know whether these can solve your problem. If this was not useful for you, I'm sorry.
来源:https://stackoverflow.com/questions/47892350/apps-script-execution-api-showing-error-with-devmode-true