Agile Central - WSAPI: Get AllowedValues for dropdown fields

Document ID : KB000057584
Last Modified Date : 14/02/2018
Show Technical Document Details
Introduction:

If a user is logged in to CA Agile Central UI in a non-default workspace, and hits AllowedValues endpoint in another tab of the same browser window, and later switches from a non-default workspace to a default workspace in the UI, reloading the page with AllowedValues query returns results no longer scoped to the original non-default workspace.

 

 
Instructions:
NOTE: When following this example use unique ObjectIDs specific to your subscription.
We start with a typedefinition endpoint for artifacts of type Defect.
The goal is to eventually traverse from typedefinition to attirbutes to allowedvalues.
Currently we are logged in to CA Agile Central to a default workspace. In another tab of the same browser window paste this URL;
 
https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition?query=(Name = Defect)

This json is returned:
 
{
QueryResult: {
_rallyAPIMajor: "2",
_rallyAPIMinor: "0",
Errors: [ ],
Warnings: [ ],
TotalResultCount: 1,
StartIndex: 1,
PageSize: 20,
Results: [
{
_rallyAPIMajor: "2",
_rallyAPIMinor: "0",
_ref: "https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition/12352608495",
_refObjectUUID: "a86df3c6-deee-4cca-9e69-084015da1fe2",
_refObjectName: "Defect",
_type: "TypeDefinition"
}
]
}
}
 
We are interested in the /typedefinition/12352608495 endpoint. Paste the full URL in another tab of the same browser:
 
https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition/12352608495
 
Locate attirbutes:
 
Attributes: {
_rallyAPIMajor: "2",
_rallyAPIMinor: "0",
_ref: "https://rally1.rallydev.com/slm/webservice/v2.0/TypeDefinition/12352608495/Attributes",
_type: "AttributeDefinition",
Count: 71
},
 
Paste attirbutes endpoint in the browser:
 
https://rally1.rallydev.com/slm/webservice/v2.0/TypeDefinition/12352608495/Attributes
 
Search the results (Ctrl+F) for a attribute name, e.g. State.
You will notice that even though ScheduleState is found, but State is not. The default page size in WS API is 20. Max page size is 200. Set the pagesize to 200 as shown below./div>
https://rally1.rallydev.com/slm/webservice/v2.0/TypeDefinition/12352608495/Attributes?pagesize=200
 
Now Ctrl+F on "State" should return more matches on the single page. Locate "State"
  • {
    • _rallyAPIMajor:"2",
    • _rallyAPIMinor:"0",
    • _refObjectUUID:"e0caf6dd-304b-447e-9d61-09ac9c96e85a",
    • _objectVersion:"1",
    • _refObjectName:"State",
    • CreationDate:"2006-02-11T12:29:05.000Z",
    • _CreatedAt:"Feb 11, 2006",
    • ObjectID:-12507,
    • VersionId:"1",
    • Subscription:{},
    • Workspace:null,
    • AllowedQueryOperators:{},
    • AllowedValueType:null,
    • AllowedValues:{ },
    • AttributeType:"RATING",
    • Constrained:true,
    • Custom:false,
    • ElementName:"State",
    • Filterable:true,
    • Hidden:false,
    • MaxFractionalDigits:span style="color: blue;">-1,
    • MaxLength:span style="color: blue;">128,
    • Name:span style="color: green;">"State",
    • Note:span style="color: green;">"State of the defect",
    • Owned:span style="color: rgb(178, 34, 34);">true,
    • ReadOnly:span style="color: rgb(178, 34, 34);">false,
    • Required:span style="color: rgb(178, 34, 34);">true,
    • Sortable:span style="color: rgb(178, 34, 34);">true,
    • SystemRequired:span style="color: rgb(178, 34, 34);">true,
    • Type:span style="color: green;">"string",
    • VisibleOnlyToAdmins:span style="color: rgb(178, 34, 34);">false,
    • _type:span style="color: green;">"AttributeDefinition"
    },
 
Paste this endpoint in the browser to get to the allowed values:
https://rally1.rallydev.com/slm/webservice/v2.0/AttributeDefinition/-12507/AllowedValues
The four State values: Submitted, Open, Fixed, Closed are returned:

{
  • QueryResult:{
    • _rallyAPIMajor:span style="color: green;">"2",
    • _rallyAPIMinor:span style="color: green;">"0",
    • Errors: [ ],
    • Warnings: [ ],
    • TotalResultCount:span style="color: blue;">4,
    • StartIndex:span style="color: blue;">0,
    • PageSize:span style="color: blue;">0,
    • Results:[
      • {
        • _rallyAPIMajor:span style="color: green;">"2",
        • _rallyAPIMinor:span style="color: green;">"0",
        • _ref:span style="color: green;">"null",
        • _refObjectUUID:span style="color: green;">"",
        • _objectVersion:span style="color: green;">"0",
        • CreationDate:span style="color: gray;">null,
        • _CreatedAt:span style="color: green;">"today at 10:17 am",
        • ObjectID:span style="color: gray;">null,
        • VersionId:span style="color: green;">"0",
        • StringValue:span style="color: green;">"Submitted",
        • _type:span style="color: green;">"AllowedAttributeValue"
        },
      • {
        • _rallyAPIMajor:span style="color: green;">"2",
        • _rallyAPIMinor:span style="color: green;">"0",
        • _ref:span style="color: green;">"null",
        • _refObjectUUID:span style="color: green;">"",
        • _objectVersion:span style="color: green;">"0",
        • CreationDate:span style="color: gray;">null,
        • _CreatedAt:span style="color: green;">"today at 10:17 am",
        • ObjectID:span style="color: gray;">null,
        • VersionId:span style="color: green;">"0",
        • StringValue:span style="color: green;">"Open",
        • _type:span style="color: green;">"AllowedAttributeValue"
        },
      • {
        • _rallyAPIMajor:span style="color: green;">"2",
        • _rallyAPIMinor:span style="color: green;">"0",
        • _ref:span style="color: green;">"null",
        • _refObjectUUID:span style="color: green;">"",
        • _objectVersion:span style="color: green;">"0",
        • CreationDate:span style="color: gray;">null,
        • _CreatedAt:span style="color: green;">"today at 10:17 am",
        • ObjectID:span style="color: gray;">null,
        • VersionId:span style="color: green;">"0",
        • StringValue:span style="color: green;">"Fixed",
        • _type:span style="color: green;">"AllowedAttributeValue"
        },
      • {
        • _rallyAPIMajor:span style="color: green;">"2",
        • _rallyAPIMinor:span style="color: green;">"0",
        • _ref:span style="color: green;">"null",
        • _refObjectUUID:span style="color: green;">"",
        • _objectVersion:span style="color: green;">"0",
        • CreationDate:span style="color: gray;">null,
        • _CreatedAt:span style="color: green;">"today at 10:17 am",
        • ObjectID:span style="color: gray;">null,
        • VersionId:span style="color: green;">"0",
        • StringValue:span style="color: green;">"Closed",
        • _type:span style="color: green;">"AllowedAttributeValue"
        }
      ]
    }
}
 
Let's consider scoping. Go back to the typedefinition endpoint and this time explicilty fetch workspace:
https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition?query=(Name = Defect)&fetch=workspace
Locate Workspace object in the return. Notice that the result is referencing the default workspace of the current user:
/div>
https://rally1.rallydev.com/slm/webservice/v2.0/workspace/12352608129
Let's switch to a another workspace in the CA Agile Central UI. To illustrate the difference we choose a workspace where State values have been customized:


User-added image
 
To scope typedefinition request to a different workspace use the query with workspace parameter:
https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition?workspace=https://rally1.rallydev.com/slm/webservice/v2.0/workspace/1448050317&query=(Name = Defect)
Here is the result:
{
QueryResult: {
_rallyAPIMajor: "2",
_rallyAPIMinor: "0",
Errors: [ ],
Warnings: [ ],
TotalResultCount: 1,
StartIndex: 1,
PageSize: 20,
Results: [
{
_rallyAPIMajor: "2",
_rallyAPIMinor: "0",
_ref: "https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition/1448050578",
_refObjectUUID: "2627e4d4-34d3-40e6-bda6-dae91111165d",
_refObjectName: "Defect",
_type: "TypeDefinition"
}
]
}
}
Notice that the ObjectID of the typedefinition 1448050578 in a non-default workspace is different from the ObjectID of the typedefinition in default workspace 12352608495:
https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition/1448050578 - A non-default workspace
https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition/12352608495 - The default workspace of the current user
 
Let's trace thespan style="font-family: courier new,courier,monospace;">/typedefinition/1448050578 to State's AllowedValues in a non-default workspace. We want to verify that those are different from the AllowedValues in the default workspace.
Paste this in another tab of the same browser:
https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition/1448050578
Locate Attributes object in the results:
 
Ctrl+F the results to locate AllowedValues for "State":
 
The AllowedValues now return 6 values (different from 4 values in the default workspace) as expected:

{
  • QueryResult:{
    • _rallyAPIMajor:span style="color: green;">"2",
    • _rallyAPIMinor:span style="color: green;">"0",
    • Errors: [ ],
    • Warnings: [ ],
    • TotalResultCount:span style="color: blue;">6,
    • StartIndex:span style="color: blue;">0,
    • PageSize:span style="color: blue;">0,
    • Results:[
      • {
        • _rallyAPIMajor:span style="color: green;">"2",
        • _rallyAPIMinor:span style="color: green;">"0",
        • _ref:span style="color: green;">"null",
        • _refObjectUUID:span style="color: green;">"",
        • _objectVersion:span style="color: green;">"0",
        • CreationDate:span style="color: gray;">null,
        • _CreatedAt:span style="color: green;">"today at 10:52 am",
        • ObjectID:span style="color: gray;">null,
        • VersionId:span style="color: green;">"0",
        • StringValue:span style="color: green;">"Submitted",
        • _type:span style="color: green;">"AllowedAttributeValue"
        },
      • {
        • _rallyAPIMajor:span style="color: green;">"2",
        • _rallyAPIMinor:span style="color: green;">"0",
        • _ref:span style="color: green;">"null",
        • _refObjectUUID:span style="color: green;">"",
        • _objectVersion:span style="color: green;">"0",
        • CreationDate:span style="color: gray;">null,
        • _CreatedAt:span style="color: green;">"today at 10:52 am",
        • ObjectID:span style="color: gray;">null,
        • VersionId:span style="color: green;">"0",
        • StringValue:span style="color: green;">"Open",
        • _type:span style="color: green;">"AllowedAttributeValue"
        },
      • {
        • _rallyAPIMajor:span style="color: green;">"2",
        • _rallyAPIMinor:span style="color: green;">"0",
        • _ref:span style="color: green;">"null",
        • _refObjectUUID:span style="color: green;">"",
        • _objectVersion:span style="color: green;">"0",
        • CreationDate:span style="color: gray;">null,
        • _CreatedAt:span style="color: green;">"today at 10:52 am",
        • ObjectID:span style="color: gray;">null,
        • VersionId:span style="color: green;">"0",
        • StringValue:span style="color: green;">"Fixed",
        • _type:span style="color: green;">"AllowedAttributeValue"
        },
      • {
        • _rallyAPIMajor:span style="color: green;">"2",
        • _rallyAPIMinor:span style="color: green;">"0",
        • _ref:span style="color: green;">"null",
        • _refObjectUUID:span style="color: green;">"",
        • _objectVersion:span style="color: green;">"0",
        • CreationDate:span style="color: gray;">null,
        • _CreatedAt:span style="color: green;">"today at 10:52 am",
        • ObjectID:span style="color: gray;">null,
        • VersionId:span style="color: green;">"0",
        • StringValue:span style="color: green;">"Closed",
        • _type:span style="color: green;">"AllowedAttributeValue"
        },
      • {
        • _rallyAPIMajor:span style="color: green;">"2",
        • _rallyAPIMinor:span style="color: green;">"0",
        • _ref:span style="color: green;">"null",
        • _refObjectUUID:span style="color: green;">"",
        • _objectVersion:span style="color: green;">"0",
        • CreationDate:span style="color: gray;">null,
        • _CreatedAt:span style="color: green;">"today at 10:52 am",
        • ObjectID:span style="color: gray;">null,
        • VersionId:span style="color: green;">"0",
        • StringValue:span style="color: green;">"Reopen",
        • _type:span style="color: green;">"AllowedAttributeValue"
        },
      • {
        • _rallyAPIMajor:span style="color: green;">"2",
        • _rallyAPIMinor:span style="color: green;">"0",
        • _ref:span style="color: green;">"null",
        • _refObjectUUID:span style="color: green;">"",
        • _objectVersion:span style="color: green;">"0",
        • CreationDate:span style="color: gray;">null,
        • _CreatedAt:span style="color: green;">"today at 10:52 am",
        • ObjectID:span style="color: gray;">null,
        • VersionId:span style="color: green;">"0",
        • StringValue:span style="color: green;">"Rejected",
        • _type:span style="color: green;">"AllowedAttributeValue"
        }
      ]
    }
}
 
Even though the AllowedValues are different in the non-defaul workspace, notice that the URL is not unique across the workspaces.
We used the same/font>
https://rally1.rallydev.com/slm/webservice/v2.0/AttributeDefinition/-12507/AllowedValues
How does CA Agile Central know how to scope if in both cases "-12507" is used? We are currently logged in to CA Agile Central in another tab of the same browser, in the non-default /workspace/1448050317
If a user switches the workspace to a default workspace where the user is logged in to CA Agile Central's UI and reloads the other page with the WS API request:
/div>
https://rally1.rallydev.com/slm/webservice/v2.0/AttributeDefinition/-12507/AllowedValues
/div>
now the AllowedValues reflect 4 values from the default workspace. This may be unexpected, since we traversed from a typedefinition requst that was expiclitly scoped to a non-default workspace.
To scope the AllowedValues request to the desired workspace regardless of what workspace the user is currently logged in in the CA Agile Central UI in another tab of the same browser window explicitly scope the request using workspace parameter:
/div>
https://rally1.rallydev.com/slm/webservice/v2.0/AttributeDefinition/-12507/AllowedValues?workspace=https://rally1.rallydev.com/slm/webservice/v2.0/workspace/1448050317
/div>
Now 6 values from a non-default workspace are returned as expected, even though we are logged in a default workspace in CA Agile Central UI in another tab of the same browser.