Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Difference between @Query and @Path on Retrofit2 Android :
- // @Query
- => Example API : https://jsonplaceholder.typicode.com/posts?userId=1&_sort=id&_order=desc
- @GET("posts")
- Call<List<Post>> getPosts(
- @Query("userId") Integer userId,
- @Query("_sort") String sort,
- @Query("_order") String order
- );
- // @Path
- => Example API : https://jsonplaceholder.typicode.com/posts/2/comments
- @GET("post/{id}/comments")
- Call<List<Comment>> getComments(@Path("id") int postId);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement