In my setup, I get all the paths for my resources from the REST API from an initial call to the API. We use this pattern to be able to change all the resource paths without breaking all existing app versions in the process.
I have been playing around with Retrofit and I tried to create a method that would accept any path I pass to it as a string. My try looks like this
@GET("/{path}")
public FooBar getFooBar(@Path("path") String path);
I then try to call it as follows.
String path = "foo/bar";
api.getFooBar(path);
Unfortunately Retrofit URL-Encodes the path replacement and I end up making a request to /foo%2Fbar instead of /foo/bar. Is there any way to disable URL-Encoding for path replacements or to make replacements spanning multiple path segments? Unfortunately I don't even know how many path segments there are, it is all controlled by the API.