Request MethodĮvery method must have an HTTP annotation that provides the request method and relative URL. Object conversion to request body (e.g., JSON, protocol buffers)Īnnotations on the interface methods and its parameters indicate how a request will be handled.URL parameter replacement and query parameter support. Use annotations to describe the HTTP request: Call> repos = service.listRepos("octocat") GitHubService service = retrofit.create(GitHubService.class) Įach Call from the created GitHubService can make a synchronous or asynchronous HTTP request to the remote webserver. Retrofit retrofit = new Retrofit.Builder() The Retrofit class generates an implementation of the GitHubService interface. public interface GitHubService String user) Retrofit turns your HTTP API into a Java interface.
0 Comments
Leave a Reply. |