2

I am querying the V1 (/query.v1 API) via Python/Dash to get all stories tagged with certain tags.

The Where criteria for API Body is

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

but I wanted to add OR criteria (something like assets tagged with "Search-Module OR Result-Module")

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

The documentation in V1 is very basic and I am not able to find the correct way for additional criteria.

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

Any pointers are appreciated.

granthik
  • 45
  • 6
  • 1
    There is an `or` operator: `|`, see https://community.versionone.com/VersionOne_Connect/Developer_Library/Learn_the_API/Data_API/Queries/where – Christian Baumann Oct 02 '20 at 06:14
  • that is for REST (GET) API, there you can add AND where=Team.Name='myTeamName'&&CreateDate>='2020-01-01' as you mentioned OR as given. In Query API you have to send (POST) query as body to get the response. I have problem there.. we are working with Query API – granthik Oct 02 '20 at 12:55

1 Answers1

1

You can set alternative values to a variable in the with property and use that variable within the where or filter property values:

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

As an option, you can use , (comma) as a separator:

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

The last example of the multi-value variable (but for the rest-1.v1 endpoint) has been found in the VersionOne Grammar project.

deftbrain
  • 26
  • 2
  • Worked fine, thanks. For future me, you can also add "find": "2021", "findin": [ "SecurityScope.Name" ], to find/filter items from the results.. – granthik Nov 12 '20 at 21:10