如何编写 API 调用 API 而 returns 仅作为布尔值作为对 android 中改造 2 的响应?

How to write API call for API that returns only boolean as response with retrofit 2 in android?

API 响应如下:

正确

我试过这样的:

@GET("url")
Call<Boolean> checkUser(@Body String emailId);

但它显示错误 "Non-body HTTP method cannot contain @Body"

试试这个

@GET("your_api_endPoint")
Call<Boolean> checkUser(@Path("parameterKey") String email);

由于错误本身表明您没有在 API 调用中传递关键参数。

而不是 Body 试试 Query("parameter_name")

喜欢下面

@GET("employees/details")
Call<Boolean> checkUser(@Query("emailId") String emailId);