【问题标题】:Adding OR condition in VersionOne Query API在 VersionOne 查询 API 中添加 OR 条件
【发布时间】:2021-01-17 13:45:23
【问题描述】:

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

API Body 的 Where 条件是

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

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

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

V1 中的文档非常基础,我无法找到附加标准的正确方法。

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

任何指针表示赞赏。

【问题讨论】:

  • 用于 REST (GET) API,您可以在其中添加 AND where=Team.Name='myTeamName'&&CreateDate>='2020-01-01' 如您所提到的或给定的。在查询 API 中,您必须将 (POST) 查询作为正文发送以获取响应。我有问题..我们正在使用查询 API

标签: python api postman plotly-dash versionone


【解决方案1】:

您可以为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 端点)。

【讨论】:

  • 工作得很好,谢谢。对于未来的我,您还可以添加“find”:“2021”,“findin”:[“SecurityScope.Name”],以从结果中查找/过滤项目..
猜你喜欢
  • 1970-01-01
  • 2016-09-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-02-21
  • 2020-11-15
  • 2011-03-18
  • 1970-01-01
相关资源
最近更新 更多