Search code examples
versionone

How do I return all Attributes in the VersionOne Rest-1.v1 API for a Given Task


How do I return all attributes for Task for a given Task ID using the VersionOne Rest-1.v1 API. I have been able to successfully pull for a given task and a subset of the attributes, but I would like to review all attributes.

Kind of a "select * from ".

Currently Using:

./rest-1.v1/Data/Task?sel=Name,Scope.Name,CreateDate&where=Owners.Name='SnowWhite';CreateDate>'2016-05-01T00:00:00.001'

Solution

  • Here is a pattern that I suggest

    1) Decide on what data is important - Performing VersionOne Meta queries will help you see the "schema" of the asset in question. In your case the asset is a Task.

    YourV1Instance/meta.v1/Task?xsl=api.xsl

    will show a listing of all of the attributes that are associated with the Task. You'll see a combination of

    • Simple Scalars - Name (text) and Todo (numeric)

    • Simple Relation - CreatedBy. This is a reference to a single Member asset in VersionOne.

    • Multi-Relation - Owners. This is a reference to 0 or more Member assets

    2) Select the data using sel - As you have seen, VersionOne returns a subset of all of the stuff found in the meta query mentioned above. This subset are the attributes that represents the highest probability of usefulness. This is true for all VersionOne attributes (ie Story, Defect...). It would be an unnecessary load on a system to always retrun everything in an asset because you will never need it all. If you want it all to be returned, you would have to include each attribute in your select or create code to read all of the attributes and build a giant query. This is inefficient and unproductive. If you are interested what data lives in the attributes, bear in mind that much of the data is system specific attributes and has almost no immediate, user value. These assets are subject to change.

    if you are performing a data query, as you have discovered,

    YourV1Instance/rest-1.v1/Task

    will return all of preset attributes which represent the attributes that the majority of the users need.