如何让 Retrofit 方法获得无参数?

Meg*_*nda 0 methods android retrofit

我想通过改造获取数据,但我有问题,我会用代码来解释

ApiService.class :
public interface ApiService {

@GET
Call<ResponseBody> artikel();
}
Run Code Online (Sandbox Code Playgroud)

和我的过程类

Call<ResponseBody> get_artikel;
    Retrofit retrofit;
    retrofit = new Retrofit.Builder()
            .baseUrl(Status.HOST_ARTICLE + "content/" + list.get(conversationQueue).conversationId + "/")
            .addConverterFactory(GsonConverterFactory.create())
            .client(httpClient)
            .build();


    ApiService apiService = retrofit.create(ApiService.class);
    get_artikel = apiService.artikel();
Run Code Online (Sandbox Code Playgroud)

如果这样,我有错误

缺少@GET URL 或@Url 参数。

我知道在 ApiService 中我必须在 Get 中创建参数“/content/”,但我需要在这样的过程类中创建它

baseUrl(Status.HOST_ARTICLE + "content/" + list.get(conversationQueue).conversationId + "/")

什么是最好的解决方案?

谢谢

Epi*_*rce 5

  retrofit = new Retrofit.Builder()
        .baseUrl(Status.HOST_ARTICLE + "/" )
        .addConverterFactory(GsonConverterFactory.create())
        .client(httpClient)
        .build();
Run Code Online (Sandbox Code Playgroud)

public interface ApiService {

     @GET("content/{conversationId}" ) 
     Call<ResponseBody> artikel(@Path("conversationId") String conversationId);
}
Run Code Online (Sandbox Code Playgroud)

然后

apiService.artikel(list.get(conversationQueue).conversationId) ;
Run Code Online (Sandbox Code Playgroud)