Hello I want to Connect the app engine to Appscript project but constantly get
Exception in thread "DefaultDispatcher-worker-1" com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found
{
"code" : 404,
"errors" : [ {
"domain" : "global",
"message" : "Requested entity was not found.",
"reason" : "notFound"
} ],
"message" : "Requested entity was not found.",
"status" : "NOT_FOUND"
}
first I added new scopes - the same as I have on my oauth2 cloud console set by function
object AppCredentials {
val local: HttpRequestInitializer by lazy {
HttpCredentialsAdapter(GoogleCredentials.fromStream(pathStream).createScoped(scopes))
}
private val pathStream
get() = AppCredentials::class.java.getResourceAsStream(credentialsFilePath)
?: error("Resource not found: $credentialsFilePath")
private val scopes by lazy {var res = arrayListOf<String>()
// res.addAll(SheetsScopes.all())
res.addAll(createListOfScopesStrings())
res
}
init {
}
}
/**gets Strings of scopes that we are intrested in*/
private fun createListOfScopesStrings(): ArrayList<String> {
val res = ArrayList<String>()
// res.addAll(ScriptScopes.all())
res.addAll(
arrayListOf(
ClassroomScopes.CLASSROOM_ANNOUNCEMENTS,
ClassroomScopes.CLASSROOM_COURSES,
ClassroomScopes.CLASSROOM_COURSEWORK_ME,
ClassroomScopes.CLASSROOM_COURSEWORK_STUDENTS,
ClassroomScopes.CLASSROOM_GUARDIANLINKS_STUDENTS
,
ClassroomScopes.CLASSROOM_PROFILE_EMAILS,
ClassroomScopes.CLASSROOM_PUSH_NOTIFICATIONS,
ClassroomScopes.CLASSROOM_ROSTERS,
ClassroomScopes.CLASSROOM_TOPICS,
ClassroomScopes.CLASSROOM_STUDENT_SUBMISSIONS_STUDENTS_READONLY
)
)
res.addAll(DriveScopes.all())
res.addAll(CalendarScopes.all())
res.addAll(SheetsScopes.all())
res.addAll(ScriptScopes.all())
return res
}
private const val credentialsFilePath = "/credential.json"
I deployed them as api executables and set the possibility of access to anyone. After setting up some methods I changed the version .
I copied the script id and tried to connect by code as presented below
val scriptId = "MiTs599IhwfuT-yilc1N31_ZQHuFeqzZk"
// val scriptId = "Mqk0beL1sHumqKnvww4rMsvZQHuFeqzZk"
// 1
private val transport = GoogleNetHttpTransport.newTrustedTransport()
// 2
private val jacksonFactory = JacksonFactory.getDefaultInstance()
// 3
private val scriptService = Script.Builder(transport, jacksonFactory, AppCredentials.local).build()
val request = ExecutionRequest()
request.setFunction("setBasicStudentDataFromFilledFormsTop")
The script Id and function name is ok i checked it couple times, so Why it is not connecting?
I will greatly appriciate help !