Having trouble using API Key with retrofit get request
I am new to retrofit. I need to use an API key to access this API to retrieve country data. I have placed my API key inside the header in place of MY_API_KEY.
interface CountryApi {
@Headers("api-key: MY_API_KEY")
@GET("all")
suspend fun getCountryData(): List
}
I get the following error when I run the project.
2022-07-07 18:27:31.768 6035-6035/com.example.countryapp1 E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.countryapp1, PID: 6035
retrofit2.HttpException:...