Is it possible to recieve only String response using Retrofit library? I have a situation where I need to add Query on my link so that link is looking like : localhost//Regi
You can get the response from api and convert it to string like this:
public interface RetrofitService{
@GET("/users")
Call listRepos();//function to call api
}
RetrofitService service = retrofit.create(RetrofitService.class);
Call result = service.listRepos(username);
result.enqueue(new Callback() {
@Override
public void onResponse(Response response) {
try {
System.out.println(response.body().string());//convert reponse to string
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public void onFailure(Throwable t) {
e.printStackTrace();
}
});