我正在尝试使用 http://192.168.1.64:5050/api/{api_key}/updater.info
之类的方式访问资源。
如何动态设置 api_key
参数?我尝试使用 RequestInterceptor
没有成功,其中基本 url 是 http://192.168.1.64:5050/api/{api_key}
。
@Override
public void intercept(RequestFacade request) {
request.addPathParam("api_key", apiKey);
}
还有其他选择吗?
最佳答案
使用这个:
@PUT("/path1/path2/{userId}")
void getSomething(
@Path("userId") String userId
);
然后你像这样调用方法:
String userId = "1234";
service.getSomething(userId);
关于android - 改造中的动态路径,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23279006/