I am new to Kotlin and Retrofit. I want to call a base URL through Retrofit and print the raw JSON response. What would be the simplest minimal configuration?
Let's say,
base url = "https://devapis.gov/services/argonaut/v0/" 
method = "GET"
resource = "Patient"
param = "id"
I tried,
val patientInfoUrl = "https://devapis.gov/services/argonaut/v0/"
        val infoInterceptor = Interceptor { chain ->
            val newUrl = chain.request().url()
                    .newBuilder()
                    .query(accountId)
                    .build()
            val newRequest = chain.request()
                    .newBuilder()
                    .url(newUrl)
                    .header("Authorization",accountInfo.tokenType + " " + accountInfo.accessToken)
                    .header("Accept", "application/json")
                    .build()
            chain.proceed(newRequest)
        }
        val infoClient = OkHttpClient().newBuilder()
                .addInterceptor(infoInterceptor)
                .build()
        val retrofit = Retrofit.Builder()
                .baseUrl(patientInfoUrl)
                .client(infoClient)
                .addConverterFactory(GsonConverterFactory.create())
                .build()
        Logger.i(TAG, "Calling retrofit.create")
        try {
            // How to get json data here
        }catch (e: Exception){
            Logger.e(TAG, "Error", e);
        }
        Logger.i(TAG, "Finished retrofit.create")
    }
How can i get the raw json output. I don't want to implement user data class and parsing stuffs if possible. Is there any way?
Update 1
Marked duplicated post (Get raw HTTP response with Retrofit) is not for Kotlin and I need Kotlin version.
 
     
     
    