Search code examples
restapiconsoleversionone

Version One - Fetching Dependencies using the rest api in the console


Hello So I have been trying to fetch records using the Version one rest1-v1 api and I am currently testing the response using the API console provided by Version One. My query looks like rest-1.v1/Data/Story?sel=Name,Number,Scope.Name,Scope.ID,Dependencies&where=Number="StoryID"

Now to elaborate the story that I am trying to retrieve contains both upstream as well as downstream dependencies. Using the above query i can fetch the upstream dependencies and I have verified using the ID's returned with the V1 portal. Would there be a way to fetch the downstream dependencies as well by adding another specific selector in the query? Since the UI maps with the api assets using different endpoints is there one for downstream dependencies?


Solution

  • Would there be a way to fetch the downstream dependencies as well by adding another specific selector in the query?

    Yes.

    Examining the metadata for Story , you can see attributes called

    • Dependancies - Upstream Dependencies
    • Dependants - Downstream Dependencies

    So you can use rest-1.v1/Data/Story?sel=Name,Number,Scope.Name,Scope.ID,Dependencies,Dependants&where=Number="StoryID"

    Since the UI maps with the api assets using different endpoints is there one for downstream dependencies?

    No. Same endpoint. Different attribute.

    Helpful tidbit:
    You can do things like this /rest-1.v1/Data/Story?sel=Dependencies,Dependants&where=Dependants;-Dependencies

    This will list Stories that have Upstream Deps and NO Downstream Deps. In general when you use the form where=AttributeName you are declaring that you want to return results under the condition that the AttributeName has some data in and its negation is indicated in this pattern where=-AttributeName.