看来我无法将任意查询参数设置为@Get声明

我的端点看起来像

http://api.lmiforall.org.uk/api/v1/ashe/estimateHours?soc=2349&coarse=true

该查询有大量的参数,是否可以使用声明来将其指示给@Rest接口?

我尝试将其声明为这样,但是它抱怨字段未使用。

@Get("estimateHours")
ASHEFilterInfo GetEstimateHours( int soc, boolean coarse, String filters, String breakdown);

java: @org.androidannotations.annotations.rest.Get annotated method has only url variables in the method parameters

最佳答案

AA cookbook

试试看(未测试):


@Rest(rootUrl =“ http://api.lmiforall.org.uk/api/v1/ashe”)
公共接口MyService {

    @Get(“ / estimateHours?soc = {soc}&coarse = {coarse}&breakdown = {breakdonw}&filters = {filters}”)
    ASHEFilterInfo GetEstimateHoursFiltered(int soc,布尔粗,字符串过滤器,字符串细分);

  @Get(“ / estimateHours?soc = {soc}&coarse = {coarse}&breakdown = {breakdonw}”)
    ASHEFilterInfo GetEstimateHours(int soc,布尔粗略,字符串细分);

}

关于android - @获取Android注释中的任意查询参数,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/21394825/

10-09 02:35