Agile Central - API: Adding a new value to a dropdown field
search cancel

Agile Central - API: Adding a new value to a dropdown field

book

Article ID: 10284

calendar_today

Updated On:

Products

Rally On-Premise Rally SaaS

Issue/Introduction

This article shows how to add a new value for a custom dropdown list that can be either a multi-select or single dropdown, using the WSAPI.

In this example, we will add a value a field called Agile Team on the User entity.


Environment

Release:
Component: ACAPI

Resolution

The first step is to identify the workspace Object ID that the entity type exists in. 

Open a browser and paste the following URL identify the Object ID of the workspace:
https://rally1.rallydev.com/slm/webservice/v2.0/workspace?query=&start=1&pagesize=2000&fetch=<OBJECT_ID>

Next, it is necessary to get the _ref value from the User Type Definition object.  Use the following link, changing the <WorkspaceOID> to match yours.  If you're using a different entity type such as Defect, replace User with that entity type.
https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition?workspace=https://rally1.rallydev.com/slm/webservice/v2.0/workspace/<WorkspaceOID>&query=( Name = "User" )

The _ref link you are looking for will resemble the following:
https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition/<OBJECT_OID>/Attributes

Copy that link and add a pagesize to the end so that it looke like the following:
https://rally1.rallydev.com/slm/webservice/v2.0/typedefinition/<OBJECT_OID>/Attributes?pagesize=2000

On this page, look for Department and get the _ref to the AttributeDefinition.  That link will look like this:
https://rally1.rallydev.com/slm/webservice/v2.0/AttributeDefinition/<OBJECT_OID>

Now you are ready to use a REST API client to craft your request
Endpoint: https://rally1.rallydev.com/slm/webservice/v2.0/allowedattributevalue/create
Payload:
{
    "AllowedAttributeValue": {
        "AttributeDefinition": "https://rally1.rallydev.com/slm/webservice/v2.0/attributedefinition/<OBJECT_OID>",
        "StringValue": "Whirling Dervishes",
        "ValueIndex": "6"
    }
}