Get AllowedValues for dropdown fields in CA Agile Central with Web Services API

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

Issue

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.

Resolution

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.
?
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:?-1,
    • MaxLength:?128,
    • Name:?"State",
    • Note:?"State of the defect",
    • Owned:?true,
    • ReadOnly:?false,
    • Required:?true,
    • Sortable:?true,
    • SystemRequired:?true,
    • Type:?"string",
    • VisibleOnlyToAdmins:?false,
    • _type:?"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:?"2",
    • _rallyAPIMinor:?"0",
    • Errors: [ ],
    • Warnings: [ ],
    • TotalResultCount:?4,
    • StartIndex:?0,
    • PageSize:?0,
    • Results:?[
      • {
        • _rallyAPIMajor:?"2",
        • _rallyAPIMinor:?"0",
        • _ref:?"null",
        • _refObjectUUID:?"",
        • _objectVersion:?"0",
        • CreationDate:?null,
        • _CreatedAt:?"today at 10:17 am",
        • ObjectID:?null,
        • VersionId:?"0",
        • StringValue:?"Submitted",
        • _type:?"AllowedAttributeValue"
        },
      • {
        • _rallyAPIMajor:?"2",
        • _rallyAPIMinor:?"0",
        • _ref:?"null",
        • _refObjectUUID:?"",
        • _objectVersion:?"0",
        • CreationDate:?null,
        • _CreatedAt:?"today at 10:17 am",
        • ObjectID:?null,
        • VersionId:?"0",
        • StringValue:?"Open",
        • _type:?"AllowedAttributeValue"
        },
      • {
        • _rallyAPIMajor:?"2",
        • _rallyAPIMinor:?"0",
        • _ref:?"null",
        • _refObjectUUID:?"",
        • _objectVersion:?"0",
        • CreationDate:?null,
        • _CreatedAt:?"today at 10:17 am",
        • ObjectID:?null,
        • VersionId:?"0",
        • StringValue:?"Fixed",
        • _type:?"AllowedAttributeValue"
        },
      • {
        • _rallyAPIMajor:?"2",
        • _rallyAPIMinor:?"0",
        • _ref:?"null",
        • _refObjectUUID:?"",
        • _objectVersion:?"0",
        • CreationDate:?null,
        • _CreatedAt:?"today at 10:17 am",
        • ObjectID:?null,
        • VersionId:?"0",
        • StringValue:?"Closed",
        • _type:?"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:
?
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 the?/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:?"2",
    • _rallyAPIMinor:?"0",
    • Errors: [ ],
    • Warnings: [ ],
    • TotalResultCount:?6,
    • StartIndex:?0,
    • PageSize:?0,
    • Results:?[
      • {
        • _rallyAPIMajor:?"2",
        • _rallyAPIMinor:?"0",
        • _ref:?"null",
        • _refObjectUUID:?"",
        • _objectVersion:?"0",
        • CreationDate:?null,
        • _CreatedAt:?"today at 10:52 am",
        • ObjectID:?null,
        • VersionId:?"0",
        • StringValue:?"Submitted",
        • _type:?"AllowedAttributeValue"
        },
      • {
        • _rallyAPIMajor:?"2",
        • _rallyAPIMinor:?"0",
        • _ref:?"null",
        • _refObjectUUID:?"",
        • _objectVersion:?"0",
        • CreationDate:?null,
        • _CreatedAt:?"today at 10:52 am",
        • ObjectID:?null,
        • VersionId:?"0",
        • StringValue:?"Open",
        • _type:?"AllowedAttributeValue"
        },
      • {
        • _rallyAPIMajor:?"2",
        • _rallyAPIMinor:?"0",
        • _ref:?"null",
        • _refObjectUUID:?"",
        • _objectVersion:?"0",
        • CreationDate:?null,
        • _CreatedAt:?"today at 10:52 am",
        • ObjectID:?null,
        • VersionId:?"0",
        • StringValue:?"Fixed",
        • _type:?"AllowedAttributeValue"
        },
      • {
        • _rallyAPIMajor:?"2",
        • _rallyAPIMinor:?"0",
        • _ref:?"null",
        • _refObjectUUID:?"",
        • _objectVersion:?"0",
        • CreationDate:?null,
        • _CreatedAt:?"today at 10:52 am",
        • ObjectID:?null,
        • VersionId:?"0",
        • StringValue:?"Closed",
        • _type:?"AllowedAttributeValue"
        },
      • {
        • _rallyAPIMajor:?"2",
        • _rallyAPIMinor:?"0",
        • _ref:?"null",
        • _refObjectUUID:?"",
        • _objectVersion:?"0",
        • CreationDate:?null,
        • _CreatedAt:?"today at 10:52 am",
        • ObjectID:?null,
        • VersionId:?"0",
        • StringValue:?"Reopen",
        • _type:?"AllowedAttributeValue"
        },
      • {
        • _rallyAPIMajor:?"2",
        • _rallyAPIMinor:?"0",
        • _ref:?"null",
        • _refObjectUUID:?"",
        • _objectVersion:?"0",
        • CreationDate:?null,
        • _CreatedAt:?"today at 10:52 am",
        • ObjectID:?null,
        • VersionId:?"0",
        • StringValue:?"Rejected",
        • _type:?"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?
?
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:
?
https://rally1.rallydev.com/slm/webservice/v2.0/AttributeDefinition/-12507/AllowedValues
?
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:
?
https://rally1.rallydev.com/slm/webservice/v2.0/AttributeDefinition/-12507/AllowedValues?workspace=https://rally1.rallydev.com/slm/webservice/v2.0/workspace/1448050317
?
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.