Description
Creates a step template. propertiesRaw is a JSON-encoded array of property definitions - the inputs a project step built from this template asks for, and the values it starts with. See below for the shape.
Step templates are the building blocks projects pick from when defining steps.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
workspaceId |
body | string | yes | ID of the workspace. |
name |
body | string | yes | Template name. |
description |
body | string | no | Optional description. |
supportedRunModes |
body | array<string> | no | See below. |
script |
body | string | yes | Body of the script. |
scriptLanguage |
body | string | no | powershell (default, PowerShell 7), powershell5 (Windows PowerShell 5.1) or python (Python 3). |
propertiesRaw |
body | string | no | JSON-encoded array of property definitions. Defaults to "[]". See below. |
Supported run modes
Each supportedRunModes entry must be TargetMachine, Worker, or WorkerToCloudTargets. Values that cannot be parsed are ignored; if no valid entries remain, the request returns 400.
Property definitions
propertiesRaw is a string holding a JSON array, so it is JSON-encoded twice inside the request body. Each element describes one input on the form shown when the template is added to a project.
Id- identifier, unique among its siblings. The script reads the value asSTEP.<Id>, orSTEP.<GroupId>.<ChildId>for a property nested in a group.Name- the label shown above the control.Description- optional help text under it.ControlType- one ofSingleLineText,MultiLineText,SecureString,Checkbox,Number,DropDownList,ScriptEditor,JsonEditor,PackageSelector,CloudAccountSelector,PropertyGroup.ControlTypeOptions- settings the control needs.ScriptEditortakesLanguage(powershell,powershell5,pythonorjson),CloudAccountSelectortakesCloudType.ControlValues- the options offered by aDropDownList, as[{"Name": "shown in the list", "Value": "read by the script"}].DependsOn- show this property only while another one holds a value, as{"ControlId": "OtherProperty", "Operator": "Equals", "Value": "yes"}.OperatorisEqualsorNotEquals, andControlIdis the other property'sId, written<GroupId>.<ChildId>when it sits inside a group.Properties- the nested array aPropertyGroupcontains. Groups hold other properties and no value of their own.
Initial property values
There is no DefaultValue field. A starting value goes in the typed field that matches the control.
| Control type | Field to set |
|---|---|
SingleLineText, MultiLineText, SecureString, ScriptEditor, JsonEditor, DropDownList, CloudAccountSelector | ValueText |
Checkbox | ValueBoolean |
Number | ValueNumber |
PackageSelector | ValueObject |
A step added from the template starts with those values, and whoever adds the step can change them afterwards. DropDownList is the exception - a new step always takes the first ControlValues entry, whatever ValueText says.
Setting IsBound to true replaces the control with a variable expression editor. ValueText then holds an expression such as #{ServiceName} that is resolved at deploy time, whatever the control type is.
Any other member of a property object is discarded when the template is saved. The request still returns 200, and the discarded field is simply absent from the schema that Get step template details returns. DefaultValue is the one to watch for - it reads as though it should work, and a template carrying it produces steps whose inputs are empty.
Errors
| Status | Meaning |
|---|---|
400 |
Invalid workspaceId, invalid scriptLanguage, or validation failure. |
401 |
Missing or invalid Basic auth credentials, or the service account lacks the required role. |