1

我正在尝试运行下面给出的代码,其中“myApp”是我要运行的脚本中的函数名称。

ExecutionRequest request = new ExecutionRequest().setFunction("myApp").setDevMode(true);
try {
    Operation op = service.scripts().run("some id", request).execute();
    // Print results of request.
    if (op.getError() != null) {
        // The API executed, but the script returned an error.
        System.out.println("Error");
    } else {
        System.out.println("Success");
    }
} catch (GoogleJsonResponseException e) {
    e.printStackTrace(System.out);
}

它给我的错误是:

{“代码”:404,“错误”:[{“域”:“全局”,“消息”:“未找到请求的实体。”,“原因”:“未找到”}],“消息”:“请求找不到实体。”,“状态”:“NOT_FOUND”}

或者,如果我将其部署为 Web 应用程序,则会出现此类错误:

com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden { "code" : 403, "errors" : [ { "domain" : "global", "message" : "调用者没有权限", “原因”:“禁止”}],“消息”:“调用者没有权限”,“状态”:“PERMISSION_DENIED”}

我必须做什么完美地运行代码????

4

0 回答 0