Rally

Updating a custom Drop Down List (Multi Value) through Agile Central web services (WSAPI) 

Nov 08, 2017 01:56 PM

The following example uses a custom field named "MULTI" on the Defect type. It also assumes basic knowledge of the CA Agile Central Web Service API.

 

Note: the refs and object ids used in the examples below are specific to your subscription so copying and pasting the exact examples will not work.

 

Because these fields are really collections, to add/remove/update them you need to know the allowed values. AllowedValues is a collection attribute on AttributeDefinition which provides these. To retrieve these you must know your custom AttributeDefinition ObjectID.

 

Finding AllowedValues for a field

1. Find the TypeDefinition in your workspace (each workspace has its own TypeDefinition instances because they can each have different custom attributes) using the typedefinition endpoint and a query param to filter the results down and a fetch param to show the Attributes collection.

 

https://rally.rallydev.com/slm/webservice/v2.0/typedefinition?workspace=/workspace/53692104364&query=(ElementName%20=%20%22Defect%22)&fetch=Attributes

 

One of the results:

{
  "_ref": "https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition/53692104689",
  "_refObjectUUID": "393c2ef7-0853-4f62-99c6-b240143c57fc",
  "_refObjectName": "Defect",
  "Attributes": {
    "_ref": "https://rally1.rallydev.com/slm/webservice/v2.0/TypeDefinition/53692104689/Attributes",
    "Count": 83
  },
}

2. use the Attributes collection _ref (underlined in the example above) along with a query by name to filter the results

 

https://rally1.rallydev.com/slm/webservice/v2.0/TypeDefinition/53692104689/Attributes

 

One of the results: 

{

  "_refObjectName": "MULTI",

  "AllowedValues": {
    "_rallyAPIMajor": "2",
    "_rallyAPIMinor": "0",
    "_ref": "https://rally1.rallydev.com/slm/webservice/v2.0/AttributeDefinition/57017566411/AllowedValues",
    "_type": "AllowedAttributeValue",
    "Count": 5
  }
}

 

3. The AllowedValues collection ref can then be used to list the AllowedAttributeValue objects and their refs which will be used when updating the field below

 

https://rally1.rallydev.com/slm/webservice/v2.0/AttributeDefinition/57017566411/AllowedValues?fetch=StringValue

 

One of the results:

{
  "_ref": "https://rally1.rallydev.com/slm/webservice/v2.0/allowedattributevalue/57017566413",
  "_refObjectUUID": "c432a887-e5bc-4d7d-bc6e-64fde010055b",
  "StringValue": "A",
  "_type": "AllowedAttributeValue"
}

 

 

Updating the field

There are two ways to update this type of field:

 

  1. Using the collection endpoint (https://rally1.rallydev.com/slm/doc/webservice/)

 

curl -H "Content-Type: application/json" \

-H "ZSESSIONID:_5507" \

-X POST \

-d '{"CollectionItems":[{"_ref":"allowedattributevalue/57017566413"}]}' \

https://rally1.rallydev.com/slm/webservice/v2.0/Defect/172179831268/c_MULTI/add

 

  1. Setting as a basic field in an object update

 

curl -H "Content-Type: application/json" \

-H "ZSESSIONID:_5507" \

-X POST \

-d '{"Defect":{"c_MULTI":[{"_ref":"allowedattributevalue/57017566413"},{"_ref":"/allowedattributevalue/57017566416"}]}}' \

https://rally1.rallydev.com/slm/webservice/v2.0/defect/172179831268

Statistics
0 Favorited
12 Views
0 Files
0 Shares
0 Downloads

Related Entries and Links

No Related Resource entered.