
I struggled with the new URL way when I started to use this new version. But it’s easy to understand (after miss much because of the old version vices)! Just keep in mind that the base URL and specific URL of a resource are concatenated. So, you must to take care with ‘/’ at the begining and end of URLs. Let’s define a simple rule to avoid mistakes:
The base API URL set in retrofit instance MUST ALWAYS end with ‘/’
new Retrofit.Builder().baseUrl("http://api.themoviedb.org/3/")
The specific URL of a resource must never be initiated with ‘/’
public interface APIService { | |
@GET("item/") | |
Call listItens(); | |
} |