Reputation: 412
I would like to call GitHub API to return the list of repositories based on an arbitrary search parameter like this: https://api.github.com/search/repositories?q=custom_search_param
So the custom_search_param is declared at runtime.
I made this interface:
public interface GitHubClient {
String BASE_URL = "https://api.github.com/";
@GET("search/repositories")
Call<GitHubRepo> getReposForSearchParam (@Query("q") String custom_search_param);
}
I call it in MainActivity onCreate like this:
Retrofit retrofit = new Retrofit.Builder().baseUrl(GitHubClient.BASE_URL).addConverterFactory(GsonConverterFactory.create()).build();
GitHubClient gitHubClient = retrofit.create(GitHubClient.class);
Call<GitHubRepo> call = gitHubClient.getReposForSearchParam("tetris");
call.enqueue(new Callback<GitHubRepo>() {
@Override
public void onResponse(Call<GitHubRepo> call, Response<GitHubRepo> response) {
Log.d("resp",response.toString());
Log.d("respBody",response.body().toString());
}
@Override
public void onFailure(Call<GitHubRepo> call, Throwable t) {
Log.e("wentWrong", t.getMessage());
}
});
And I am always getting onFailure
response with this message:
E/wentWrong: javax.net.ssl.SSLProtocolException: SSL handshake aborted: ssl=0xb8679dd0: Failure in SSL library, usually a protocol error error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version (external/openssl/ssl/s23_clnt.c:741 0x9db10901:0x000
00000)
Does anyone know what is going wrong here and if GitHubClient interface anottations should be declared in different way?
Upvotes: 0
Views: 136
Reputation: 1688
since the GitHub api has disabled TLSv1.1 you need a device or client that supports TLSv1.1 at least. So with an android device below android 4.4 it won't work. See here.
Upvotes: 1