Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
compile ''
compile 'com.squareup.retrofit2:retrofit:2.0.2'
compile 'com.squareup.retrofit2:converter-gson:2.0.2'
public class ApiClient {
public static final String BASE_URL = "";
private static Retrofit retrofit = null;
public static Retrofit getClient() {
if (retrofit==null) {
Gson gson = new GsonBuilder()
retrofit = new Retrofit.Builder()
return retrofit;
public interface ApiInterface {
Call<String> logInWithDetails(@Field("email") String email, @Field("password") String password, @Field("submit") String submit);
private void submitDetails(String email, String password) {
ApiInterface apiService =
Call<String> call = apiService.logInWithDetails(email,password,"");
call.enqueue(new Callback<String>() {
public void onResponse(Call<String> call, Response<String> response) {
Log.d(TAG," ONRESPONSE : "+response.raw());
Log.d(TAG," ONRESPONSE : "+response.body());
public void onFailure(Call<String> call, Throwable t) {
Log.d(TAG," ONRESPONSE : "+t.getLocalizedMessage());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment