retrofit2.HttpException: HTTP 403 Forbidden

Viewed 1627

I am currently making an app that fetches the data from rapid API. but I am getting the error :

retrofit2.HttpException: HTTP 403 Forbidden

I don't know what's the problem, if anyone know the solution please help me.

This is the get request I am making :

interface ApiService {

@GET("product/search?")
suspend fun getResult(@Query("keyword")keyWord: String, @Query("country")country: String, @Query("category")category: String,
@Header("x-rapidapi-key")apiKey: String, @Header("x-rapidapi-host")apiHost: String): List

}
2 Answers

Do you have a HttpLoggingInterceptor? check it from here to verify that everything has been sent well.
If everything went well, the issue is from the backend side.

Can you provide the api contract?

Maybe there is an unnecessary question mark at the end of the path.

@GET("product/search?")
Related