Skip to content
This repository was archived by the owner on Mar 9, 2026. It is now read-only.
This repository was archived by the owner on Mar 9, 2026. It is now read-only.

V1Meta queries only returning first result of multivalue attribute (e.g. TaggedWith) #37

Open

Description

@WesleyWeber

If I request the TaggedWith property via SELECT or just as a base attribute with WHERE, V1Meta will only return the first tag of a Story/Epic. This is an actual issue that may cause people headaches.

There are 4 tags on this epic:
for x in v1.Epic.where(Number=epic):

print (x.TaggedWith)
--prints "Tag1"

for epic in z:
for result in v1.Epic.select('Number','TaggedWith').where(Number=epic):
print (result.TaggedWith)
--prints "Tag1"

I have confirmed that if you go through the query.v1 endpoint, you will get what you expect:

http://baseURL/InstanceName/query.v1

Payload YAML Body ==
from: Epic
select:
- TaggedWith
where:
Number: E-10021

Response
[
[
{
"_oid": "Epic:520947",
"TaggedWith": [
"Tag1",
"Tag2",
"Tag3",
"Tag4"
]
}
]
]

Originally posted by @fahrenberger in #23 (comment)

Activity

  1. WesleyWeber commented on Nov 21, 2019

    @WesleyWeber
    Author

    Not the best solution - but now after getting each (e.g.) Epic, I then call this function to return the full list of tags and then return them to be placed in a local_epic object. [keymaster] is simply an object containing API connection values.

    tags = getTags(keymaster,result.Number)
    local_epic['TaggedWith'] = tags
    
    def getTags(keymaster,NUMBER):
        API_ENDPOINT = config['V1']['QRY_ENDPOINT']
      
        PAYLOAD = {    
            "from": "Epic",
            "select": [ 
                "Number",
                "TaggedWith"
                ],
            "where": {
                "Number": "{}".format(NUMBER)
                }
        }
    
        headers_ = {"Authorization": "Bearer {}".format(keymaster['v1_token']),"Accept": "application/json, text/plain, */*","Content-Type": "application/json"}
        response = requests.post(url=keymaster['v1_query'], headers=headers_, data=json.dumps(PAYLOAD))
    
        x = json.loads(response.text)
    
        x_return = ""
    
        for tag in x[0][0]['TaggedWith']:
            x_return = tag + ", " + x_return
    
    
        return(x_return[:-2])
    
  2. DurandalSolutions commented on Aug 21, 2024

    @DurandalSolutions

    It's been years since this answer was posted. I'm attempting to use v1pysdk to add/update a tag.
    Question: What is "keymaster" and what is in config? I'm hoping that it comes from the V1Meta instance.
    TIA (if I get an answer!).
    I do understand that ... five years later.. a response is unlikely!

  3. WesleyWeber commented on Aug 22, 2024

    @WesleyWeber
    Author

    If I recall correctly - keymaster is what I called the confgparser object (see, https://docs.python.org/3/library/configparser.html).

    This would have ultimately been a dictionary of values, where in a text file I had something like:

    v1_token = my_v1_api_token
    vq_query = the_select_query_I_was_executing
    

    I haven't used V1 since 2019, so I can't remember where I got the api key/token from within the instance. From the documentation (https://versionone.github.io/api-docs/#intro):

    VersionOne uses access tokens to grant access to the API. You can register a new access token by logging into VersionOne and navigating to the Applications page. This is the suggested way to interact with the VersionOne API.

  4. DurandalSolutions commented on Aug 25, 2024

    @DurandalSolutions

    Thank you very... I'm ecstatic that you have responded.
    I was attempting to find a way to use the existing v1pysdk connection/url to execute the query you had done. My lack of experience using REST API's and V1PYSDK has resulted in this taking more effort. However, your post shows that a mixed approach is the way to go.

    Thank you again for the response. I really appreciate that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions