title: Java - Retrofit 2 requests good practices
body: <p>I'm currently using retrofit for an Android application.
  It is pretty new to me, and I'm trying to figure out the best way to handle simple requests without getting messy.</p>
  
  <p>My client is communicating with my server using JSON (retrofit's JacksonConverter). 
  So for now, I ended up doing something like this:</p>
  
  <pre><code>public interface MyWebService {
  
      class RequestLogin {
          public String email;
          public String hash;
  
          public RequestLogin(String email, String hash) {
              this.email = email;
              this.hash = hash;
          }
      }
  
      @POST("/login")
      Call&lt;String&gt; login(@Body RequestLogin body);
  
  }
  
  public void someFunction() {
      Call&lt;String&gt; call = serviceInstance.login(new RequestLogin("some_mail", "some_hash"));
  }
  </code></pre>
  
  <p>here you can see that my <code>/login</code> route takes a simple JSON:</p>
  
  <pre><code>{
    "email": "some_email_here",
    "hash": "some_passwd_hash_here"
  }
  </code></pre>
  
  <p>and returns a simple string in the body.</p>
  
  <p>It is not that bad but I'm afraid things can get messy with time.</p>
  
  <p>Is creating an object the only way to use JSON inside the body of a request using retrofit?</p>
  
  <p>Maybe there's a way to do something like this instead:</p>
  
  <pre><code>@POST("/login")
  Call&lt;String&gt; login(@MagicTag String email, @MagicTag String hash);
  </code></pre>
  
  <p>I might be missing it from the javadoc from the library, but the website is not very clear when you've never used it. I didn't find any sample using it if it exists. </p>