Hey guys I'm trying to get data from an API. I can use this https://raw.githubusercontent.com/atilsamancioglu/K21-JSONDataSet/master/crypto.json json file it's work but I can't make this work. https://www.episodate.com/api/most-popular?page=1
HERE IS MY MAIN ACTIVITY
private fun loadData(){
val retrofit = Retrofit.Builder()
.baseUrl("https://www.episodate.com/")
.addConverterFactory(GsonConverterFactory.create())
.build()
.create(MovieAPI::class.java)
CoroutineScope(Dispatchers.IO).launch {
val response = retrofit.getData()
if (response.isSuccessful){
response.body()?.let {
Moviemodel = ArrayList(it)
}
}
println(Moviemodel)
}
MY DATACLASS
data class MovieModel(
val name: String
)
AND API CLASS
interface MovieAPI {
@GET("api/most-popular?page=1")
suspend fun getData(): Response<ArrayList<MovieModel>>
When I try https://raw.githubusercontent.com/atilsamancioglu/K21-JSONDataSet/master/crypto.json this file I can get datas but whenever I try this https://www.episodate.com/api/most-popular?page=1 apps crash. Please take a look thank you.