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"
> }
>
>
Generally I proceeded with the tutorial of 
https://www.raywenderlich.com/4656683-build-an-api-with-kotlin-on-google-cloud-platform
 to 
set up a project , and the part of authenticating to connect to google 
sheet and display it works fine - so basic authenthication works than I set 
upsome modifications to be able to connect to App script files on my google 
account 

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 ! 

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/a621c453-908e-42ad-bca6-bed2810d7a3d%40googlegroups.com.
  • [google-appengine... Jakub Mitura

Reply via email to