我正在使用Groovy 1.8和HttpBuilder 0.5.1与REST Web界面进行通信。我有这个工作:
def JSONArray tasks = httpBuilder.get( path: 'workspaces/'+LP_WORKSPACE_ID+'/tasks', query: [filter:'is_done is false'] );
def JSONArray tasks = httpBuilder.get( path: 'workspaces/'+LP_WORKSPACE_ID+'/tasks', query: [filter:'external_reference contains /'] );
我需要将这些2合并为1.我得到了关于它应该如何显示的文档:
/api/workspaces/:workspace_id/tasks?filter[]=is_done is false&filter[]=external_reference starts with /
如何在同一个GET中将相同的查询变量(过滤器)组合2次?
我试过了:
def JSONArray tasks = liquidPlanner.get( path: 'workspaces/'+LP_WORKSPACE_ID+'/tasks', query: ['filter[]':'external_reference contains /', 'filter[]':'is_done is false'] );
但这不起作用。
的问候,
维姆
答案 0 :(得分:2)
尝试以下方法:
def JSONArray tasks = liquidPlanner.get(
path: 'workspaces/'+LP_WORKSPACE_ID+'/tasks',
query: ['filter[]':['external_reference contains /', 'is_done is false']]
);