retrofit 2 @path Vs @query
<p>I am new to retrofit 2 library.I read several articles to get started as a beginner and I managed to fetch XML data from my RESTful API without specifying parameters.In my method that generated the XML resource is below. </p>

<pre><code>@GET
@Path("/foods")
@Produces(MediaType.APPLICATION_XML)
public List&lt;FoodPyramid&gt; getFoodPyramid() {
    Session session = HibernateUtil.getSessionFactory().openSession();
    trans = session.beginTransaction();
    List&lt;FoodPyramid&gt; foodList = session.createQuery("from FoodPyramid").list();
    try {
        trans.commit();
        session.close();
    } catch (Exception e) {
        session.close();
        System.err.println("Food Pyramid fetch " + e);
    }
    System.err.println("Am in the food modal. . . . . . . .");
    return foodList;
}
</code></pre>

<p>Now when I tried to pass parameter in the interface</p>

<pre><code>@GET("user/{username}/{password}")
Call&lt;List&lt;UserCredentail&gt;&gt; getUserOuth(@Query("username") String username, @Query("password") String password);  
</code></pre>

<p>It failed to run,no data was receive by a client . It took me a week trying to fix it though by using a non parameter call fetched the resources;
So tried to change it to:  </p>

<pre><code>@GET("user/{username}/{password}")
Call&lt;List&lt;UserCredentail&gt;&gt; getUserOuth(@Path("username") String username, @Path("password") String password);  
</code></pre>

<p>and it worked fine. So My question is: When do I need to use <code>@Query</code> and <code>@Path</code> Annotation in retrofit 2?</p>