Rally Software

 View Only

 API - getting allowed values for custom defect field

Petr_Sedlacek's profile image
Broadcom Employee Petr_Sedlacek posted Sep 23, 2023 09:51 PM

Hello,

for a defect object, using the Rally API, I need to get all allowed values for the custom field.

For example

I have a defect with ID 8524582, and a custom drop-down menu called "c_OS_Version".

The drop-down menu contains values "1.0", "1.1", "1.5", "2.0".

Using Rally API I need to get all these predefined values.

Thank you!

Petr

David LeDeaux's profile image
Broadcom Employee David LeDeaux

That information isn't available from WS API, however you can look at the schema to parse that out

You'll need your workspace object ID and you'll attach it to the end of this URL:

https://rally1.rallydev.com/slm/schema/v2.0/workspace/<workspace object ID>

Petr_Sedlacek's profile image
Broadcom Employee Petr_Sedlacek

Thanks David.

That helped.

What I did was the following.

1.

https://rally1.rallydev.com/slm/webservice/v2.0/workspace/

to get the workspace _ref atribute

2.

then the _ref= https://rally1.rallydev.com/slm/webservice/v2.0/workspace/{WorkspaceID}

to get the _ref to TypeDefinitions

3.

then the _ref=https://rally1.rallydev.com/slm/webservice/v2.0/Workspace/{WorkspaceID}/TypeDefinitions

but better to modify it to 

https://rally1.rallydev.com/slm/webservice/v2.0/Workspace/{WorkspaceID}/TypeDefinitions?&fetch=true&query=(Name%20=%20Defect)

to get the Defect object definition ID and _ref to Attribute Definition.

4.

then the _ref=https://rally1.rallydev.com/slm/webservice/v2.0/TypeDefinition/{DefectObjID}/Attributes

but better to modify it to

https://rally1.rallydev.com/slm/webservice/v2.0/TypeDefinition/{DefectObjID}/Attributes?&fetch=true&query=(Name%20=%20%22{AttributeName}%22)

to get AllowedValues _ref for a given AttributeID.

5.

then finally the _ref=https://rally1.rallydev.com/slm/webservice/v2.0/AttributeDefinition/{AttributeID}/AllowedValues

to get all Allowed values for a given Attribute.

Seems like a hell but the first three steps can be skipped and repeat only steps 4 and 5 while knowing the DefectObjID and Attribute Names.

Thank you!

Have a good day.

Petr

Petr_Sedlacek's profile image
Broadcom Employee Petr_Sedlacek

Hi David,

I wanted to apply the same for "Tags", so using Work Space ID I got the Defect Object Definition ID and then the Tags attribute.

So I got the following query:

https://rally1.rallydev.com/slm/webservice/v2.0/AttributeDefinition/{Tags Obj Id}/AllowedValues

It finds the object but does not return any values.

I think that unlike other attributes the multi-value field invokes another object listing all available tags, but I can't figure out how to get the list of these Allowed Values.

Could you push me in the right direction?

Thank you!

Petr