如何使用 httpbuilder 和 groovy 执行具有多次相同参数的 GET?
我正在使用 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 /
How do I join 2 times the same query variable (filter) in the same GET ?
我尝试过这个:
def JSONArray tasks = liquidPlanner.get( path: 'workspaces/'+LP_WORKSPACE_ID+'/tasks', query: ['filter[]':'external_reference contains /', 'filter[]':'is_done is false'] );
但这不起作用。
问候,
维姆
I am using Groovy 1.8 and HttpBuilder 0.5.1 to talk to a REST webinterface. I have this working:
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 /'] );
I need to combine those 2 into 1. I got this documentation on how it should look:
/api/workspaces/:workspace_id/tasks?filter[]=is_done is false&filter[]=external_reference starts with /
How do I combine 2 times the same query variable (filter) in the same GET ?
I tried this:
def JSONArray tasks = liquidPlanner.get( path: 'workspaces/'+LP_WORKSPACE_ID+'/tasks', query: ['filter[]':'external_reference contains /', 'filter[]':'is_done is false'] );
but that does not work.
regards,
Wim
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请尝试以下操作:
Try the following: