Reputation: 3
Using android retrofit, I'm having problems referring to my url.
Either of these are ok to use:
http://www.example.com/foo.asmx/dostuf
Or
http://www.example.com/foo.ashx?r=dostuff
The examples I've seen indicate: http://www.example.com/post
What file is that processing?
So, how to I implement my url?
Thanks
Upvotes: 0
Views: 105
Reputation: 3
I've got it. Here it is to help out others...
The BASE url goes here:
Retrofit retrofit = new Retrofit.Builder().baseUrl("http://www.example.com/").build();
The ENDPOINT url goes here:
public interface retrofit_post1 {
@POST("example.ashx?r=dostuff")
Call<ResponseBody> update(@Body RequestBody requestBody);
}
Upvotes: 0
Reputation: 161
private static Retrofit retrofit = null;
public static Retrofit getClient() {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder().addInterceptor(interceptor).build();
retrofit = new Retrofit.Builder()
.baseUrl("Your Url")
.addConverterFactory(GsonConverterFactory.create())
.client(client)
.build();
return retrofit;
}
Upvotes: 1