I'm using Retrofit2.0 for making GET request to my REST URL. I don't need to pass any params to url for making the request.
How could on can make this type of request?
Here is my code what i 've done!
Interface ::
public interface AllRolesAPI {
@GET("/SportsApp/allroles")
Call<AllRolesParams> getAllRoles();
}
Class ::: I created a class using Pojo library it contains all the variables with setter and getter methods.
public void requestRoles() {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(ENDPOINT)
.build();
AllRolesAPI allRolesParams = retrofit.create(AllRolesAPI.class);
Call<AllRolesParams> allRolesParamsCall = allRolesParams.getAllRoles();
allRolesParamsCall.enqueue(new Callback<AllRolesParams>() {
@Override
public void onResponse(Call<AllRolesParams> call, Response<AllRolesParams> response) {
//response.body().getErrDesc();
Log.v("SignupActivity", "Response :: " + response.body().getErrDesc());
}
@Override
public void onFailure(Call<AllRolesParams> call, Throwable t) {
Log.v("SignupActivity", "Failure :: ");
}
});
}
When I create a request like above I have got this error in console ::
java.lang.IllegalArgumentException: Unable to create converter for class com.acknotech.kiran.navigationdrawer.AllRolesParams.