
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 ‘/’
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface APIService { | |
@GET("item/") | |
Call listItens(); | |
} |