Android 改造 post 方法

Android Retrofit post method

我有这个 post 方法,它没有正文,但我需要在对象中接收此数据

public interface ElementApi {
    @POST()
    Call<List<Element>> getElement();

}

{
    "success": true,
    "data": [
        {
            "Title": "Cuenta corriente de ahorro",
            "Description": "Encuentra una cuenta corriente para tu empresa ahora en BNB",
            "LongDescription": null
        },
    ]
}

控制台响应是

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.example.johnnhidalgo/com.example.joh.MainActivity}: java.lang.IllegalArgumentException: baseUrl must end in /: http://test/api/Values

我该如何解决?

错误说明了一切。你的基础 url 应该以 /

结尾
BASE_URL = "mobiletestws/api/Values/"; 

像这样。当我们这样做时,您的 baseUrl 看起来不像 url。它应该是这样的域名 http://example.com/api/