search cancel

CDA: How to create Dynamic Property as Prompt set with REST API

book

Article ID: 228634

calendar_today

Updated On:

Products

CA Continuous Delivery Automation - Automation Engine

Issue/Introduction

Although not documented it is possible to create Prompts through the REST API.

3 types of Prompts exist in CDA, Static, Expression and Prompt. All the different kinds can be created with the REST API but these methods cannot (all) be found in the doc (Swagger)

Cause

Not documented

Environment

Release : 12.3

Component : AUTOMATION ENGINE

Resolution

These are the general options for Dynamic Properties:

{
"dynamic": {
         "/singlelinetext_sample":
         {
          "type": "SingleLineText",
            "caption": "Sample for Single Line",
            "value": "Test value"
         },
         "/singlechoice_sample":
         {
          "type": "SingleChoice",
            "caption": "Update ingress in this deployment?",
            "choices": ["Yes","No"],
            "value": "Yes"
        },
        "/multichoice_sample":
         {
           "type": "MultiChoice",
            "caption": "Update ingress in this deployment?",
            "choices": ["Choice1","Choice2","Choice3"],
            "value": ["Choice1","Choice2"]
        },
        "/list_sample":
         {
          "type": "List",
            "value": ["ListElement1","ListElement2","ListElement3"]
        },
        "/date_sample":
         {
          "type": "Date",
            "value": "2021-11-19"
         },
         "/date_time_sample":
          {
          "type": "DateTime",  
            "value": "2021-11-19T11:12:10Z"
         },
         "/float_sample":
         {  
          "type": "Float",  
            "value": "2.57644"
         },
        "/ref_agent_sample":
         {  
          "type": "Reference",  
          "reference_main_type": "Agent",
           "value": { "name": "WIN01" }
         },
         "/ref_app_name_sample":
         {     
          "type": "Reference",  
          "reference_main_type": "Application",
          "value": { "name": "APP_01" }
         },
          "/ref_package_id_sample":
         {          
          "type": "Reference",  
          "reference_main_type": "Package",
          "value": { "id": 1965 }
         },
         "/protected_sample":
         {   
          "type": "Protected",  
          "value": "MySecretPassword"
         },
          "/shorttext_sample":
         {  
          "type": "LongText",  
          "value": "A short text"
         },
         "/longtext_sample":
         {  
          "type": "ShortText",  
          "value": "A longer text sample............"
         }
         
    }  
}

These are specific for Expression and Prompt:

Add override_in for Prompt. Value would be "Execution" or "DeploymentPackage" (not just Package as in the UI!), for example:

{
"dynamic": {
"/prompt_sample":
         {
            "type": "SingleLineText",
            "override_in": "Execution"
         }
         
    }  
}

If the value should be an expression, set value_mode to "Expression" and pass the expression as value, for example:

{
"dynamic": {
"/expression_sample":
         {
            "type": "SingleLineText",
            "value_mode": "Expression",
            "value": "{@target/system/name}"
         }    
    }  
}