Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrofit Request on IP Address with Port

I am parsing data using Retrofit. As I used to give BASE URL and END POINTS to Retrofit Request, I don't know how to give IP ADDRESS as BASE URL.

I want to use URL like : http://xxx.xxx.xx.xxx:xxxx/

Is there any suggestion how do I set my BASE URL and END POINT?

like image 958
Pratik Butani Avatar asked Feb 09 '17 08:02

Pratik Butani


1 Answers

What I am using as below with retrofit 2.

URL_BASE = http://192.168.1.11:8080

Retrofit retrofit = new Retrofit.Builder()
                .client(httpClient)
                .baseUrl(URL_BASE + "/")
                .addConverterFactory(GsonConverterFactory.create())
                .build();

End Point : http://192.168.1.11:8080/users

@GET("users")
Call<Response> getUser();
like image 59
Pratik Popat Avatar answered Sep 23 '22 05:09

Pratik Popat