【发布时间】:2016-07-05 11:18:33
【问题描述】:
如何进行这个我将在下面提到的查询?
方法@GET。查询应如下所示:
/top40?data={"ranking":"world"}
/top40?data={"ranking":"country"}
@GET("/api/top40")
Call<FamousTop40Model> getStatus(
// what should be there?
);
class Factory {
private static FamousTop40Api service;
public static FamousTop40Api getInstance() {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl(ApiConstants.BASE_URL)
.addConverterFactory(GsonConverterFactory.create())
.build();
service = retrofit.create(FamousTop40Api.class);
return service;
}
}
你们能帮帮我吗?
编辑:+ 我应该在标题中有accessKey。
【问题讨论】:
-
您要发出 Get 或 Put 请求吗?
-
获取请求,但在收到的 API 中说我应该发送 json 来接收数据。甚至可以在 Get 中发送 json 参数?
-
您可以按照下面的答案。@y07k2
-
@y07k2 是的,可以发送 json,但我不确定是否可以使用 GET 发送,但请参考此链接以使用 POST stackoverflow.com/questions/21398598/… 发送 json
标签: android json gson retrofit