Reputation: 19
I am using the retrofit. But I don't understand how to send a request without a body and I can't find anything about this in the internet... Please, write an example of the request without the body (with an url and header only)
Upvotes: 1
Views: 1150
Reputation: 10105
Just for understanding:
For GET method use:
public interface GitHubService {
@GET("users/{user}/repos")
Call<List<Repo>> listRepos(@Path("user") String user);
}
For POST method use:
public interface GitHubService {
@POST("users/user/repos")
Call<List<Repo>> listRepos(@Field("user") String user, ......<your_parametres>);
}
If you still have any doubt, please comment.
Upvotes: 0
Reputation: 8559
Everything is explained in details in the retrofit docs.
In the very first example you have GET
call without any body - just to fetch a list of github repos.
public interface GitHubService {
@GET("users/{user}/repos")
Call<List<Repo>> listRepos(@Path("user") String user);
}
Upvotes: 2