@POST(\"api/login\")
Call loginUser(@Body String user);
Here the string is actually a JSONstring i.e.
{\"email\
Convert your data in object
public class Credentials
{
public String email;
public String password;
}
Set the data to object
Credentials loginCredentials = new Credentials();
loginCredentials.email = "test@gmail.com";
loginCredentials.password = "password";
Call your api
@POST("api/login")
Call<ApiResponse> loginUser(@Body Credentials credentials);
@POST("api/login")
Call<ApiResponse> loginUser(@Body HashMap<String, String> user);
We can use Hasmap here like this.