Retrofit 2 void return

In Retrofit 2, service methods representing http methods must return Call .

Call is a generic type that should take a type that represents the return object of the http method.

For example,

 @GET("/members/{id}") Call<Member> getMember(@Path("id") Long id); 

For http methods such as deletion, the content is not returned. In such cases, which parameter should be provided by Call ?

+7
retrofit2
source share
1 answer

Just set Void as Type.

 @DELETE("/members/{id}") Call<Void> removeMember(@Path("id") Long id); 
+16
source share

All Articles