在VersionOne查询API中添加OR条件

问题描述

我正在通过Python / Dash查询V1(/query.v1 API)以获取所有带有特定标签标记的故事。

API主体的条件是

"where": {
    "TaggedWith":"Search-Module","Team.ID": "Team:009"
},

但是我想添加OR条件(类似于标有“搜索模块或结果模块”的资产)

"where": {
    "TaggedWith":"Search-Module;Result-Module",

V1中的文档非常基础,我无法找到其他条件的正确方法

https://community.versionone.com/VersionOne_Connect/Developer_Library/Sample_Code/Tour_of_query.v1

任何指针都值得赞赏。

解决方法

您可以在with属性中为变量设置替代值,并在wherefilter属性值中使用该变量:

{
  "from": "Story","select": [
    "Name"
  ],"where": {
    "Team.ID": "Team:009","TaggedWith": "$tags"
  },"with": {
    "$tags": [
        "Search-Module","Result-Module"
    ]
  }
}

作为一种选择,您可以使用,(逗号)作为分隔符:

"with": {
    "$tags": "Search-Module,Result-Module"
}

VersionOne Grammar项目中找到了多值变量的最后一个示例(但对于rest-1.v1端点而言)。