4ndro1d
4ndro1d

Reputation: 2976

Android Retrofit appends unwanted characters

I am trying to do a GET request to a json file:

https://www.someurl.com/appconfiguration.json

So I created an Interface with the following GET method

  @GET("appconfiguration.json}")
  Call<AppConfigParent> loadAppConfigParent();

and call it like this:

   final MMSATServices.AppConfigResponse appConfigResponse = new MMSATServices.AppConfigResponse();
    appConfigResponse.appConfigParent = new AppConfigParent();
    appConfigResponse.appConfigParent.configuration = null;

    Call<AppConfigParent> call = api.loadAppConfigParent();
    call.enqueue(new Callback<AppConfigParent>() {
        @Override
        public void onResponse(Call<AppConfigParent> call, Response<AppConfigParent> response) {
            appConfigResponse.appConfigParent.configuration = response.body().configuration;
            bus.post(appConfigResponse);
        }

        @Override
        public void onFailure(Call<AppConfigParent> call, Throwable t) {

        }
    });

note that the api object is the instance of the interface, whichis defined in the super class.

The actual problem is that I get a 404 repsonse:

Request{method=GET, url=https://someurl.com/appconfiguration.json%7D, tag=Request{method=GET, url=https://someurl.com/appconfiguration.json%7D, tag=null}}

As you can see %7D is appended to the URL, which leads to the 404 error. How can I get rid of this behavior?

Upvotes: 3

Views: 574

Answers (1)

shmakova
shmakova

Reputation: 6426

Remove } in @GET("appconfiguration.json}")

Upvotes: 5

Related Questions