Agile Central - WSAPI: How to locate the AttributeID of any field

Document ID : KB000117510
Last Modified Date : 12/10/2018
Show Technical Document Details
Question:
How can we find the AttributeID of a field?  For example: How can we find out the AttributeID of the 'Name' field of a User Story?
Answer:
Here is a walk-through example of how to locate the definition, including the AttributeID of the 'Name' field of a User Story.

Step 1: Find the definition of your object/artifact in the Type Definition endpoint.
Use Filter such as: (ElementName = "HierarchicalRequirement") against the TypeDefinition endpoint:

Here is this full query string:
https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition?workspace=https://rally1.rallydev.com/slm/webservice/v2.0/workspace/<YOUR Workspace ObjectID>&query=(ElementName%20%3D%20%22HierarchicalRequirement%22)&fetch=true&start=1&pagesize=20

Step 2: Get the reference to the collection of fields/attributes of your object type.
You shall see the Attributes field on your returned JSON from step 1.

User-added image


Step 3: Use that URL to reference the collection of attributes. Notice that if your total number of attributes in that collection is larger than 20 then you shall increase the pagesize argument in your query, otherwise if not specified then you shall only get the first page of 20 attributes only. Notice in this query below that pagesize = 2000, larger than the Count we saw in the previous step which is 69.

https://rally1.rallydev.com/slm/webservice/v2.0/TypeDefinition/197887696632/Attributes?query=&fetch=true&start=1&pagesize=2000

Step 4: In the JSON returned from previous step, look for the attribute name you need. In our walk-through we are looking for "Name". To look for an attribute you shall find: _refObjectName that has the name of your attribute. In our case:
"_refObjectName": "Name"

User-added image

The above screenshot is showing the JSON section of that has the definition of the 'Name' attribute we are looking for.

Step 5: Find the information you need within the JSON block of this attribute definition. In our example we are looking for AttributeID, so we shall use the "_refObjectUUID" field which has the unique identifier of this attribute definition across your subscription. Additional information that's available in this block definition will be:
- Is this attribute a custom field?
- Allowed operators for querying this attribute.
- Allowed values of this attribute.
- Is attribute required.
- Is attribute sortable.
- and more...