-3

I want know if I can use Retrofit with this type of url:

https://example.com/mobile_api.php?action=test

if I try to use Retrofit with a Base Url without the slash at the end of the url I get an Exception, my url is this:

https://example.com/mobile_api.php

not this:

https://example.com/mobile_api.php/

How I can do?

Piero
  • 9,173
  • 18
  • 90
  • 160

2 Answers2

1

Make an interface something like this

@GET("mobile_api.php")
void doSomeAction(@Query('action')String action, Callback<YourResponseClass> callback);

and then call this with your Restclient instance.

Nitesh Verma
  • 2,460
  • 4
  • 20
  • 36
1

Maybe this can help.

Retrofit 1

@GET("/path/to/api/mobile_api.php")
void getAction(@Query("action") String action, Callback<YourCallBack> response);

Retrofit 2

@GET("/path/to/api/mobile_api.php")
Call<YourCallBack> getAction(@Query("action") String action);
Tosin Onikute
  • 3,883
  • 6
  • 38
  • 61
  • Its my pleasure, i see you're new to Android from IOS dev, people don't understand how hard it is, when you are making a shift. – Tosin Onikute Sep 27 '16 at 08:41
  • 1
    Yes, it's absolutely another world, at the moment iOS is Paradise, Android is Hell :D – Piero Sep 27 '16 at 09:07