Evaluate dynamic parameters for template version
POST
CoderSessionTokenheader
Coder-Session-Token<token>templateversion*stringTemplate version ID
Format
uuidInitial parameter values
application/json- body
id?integerID identifies the request. The response contains the same ID so that the client can match it to the request.
inputs?owner_id?stringOwnerID if uuid.Nil, it defaults to codersdk.Me
Format
uuidOK
application/json- response
diagnostics?array<>id?integerparameters?array<>The samples read CODER_URL and CODER_SESSION_TOKEN: set up your environment.
curl -X POST \ "$CODER_URL/api/v2/templateversions/{templateversion}/dynamic-parameters/evaluate" \ -H "Coder-Session-Token: $CODER_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "id": 0, "inputs": { "property1": "string", "property2": "string" }, "owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05"}'const { CODER_URL, CODER_SESSION_TOKEN } = process.env;const url = `${CODER_URL}/api/v2/templateversions/{templateversion}/dynamic-parameters/evaluate`;const response = await fetch(url, { method: "POST", headers: { "Coder-Session-Token": CODER_SESSION_TOKEN, "Content-Type": "application/json", }, body: JSON.stringify({ id: 0, inputs: { property1: "string", property2: "string", }, owner_id: "8826ee2e-7933-4665-aef2-2393f84a0d05", }),});console.log(response.status, await response.text());import osimport requestsurl = ( os.environ["CODER_URL"] + "/api/v2/templateversions/{templateversion}/dynamic-parameters/evaluate")token = os.environ["CODER_SESSION_TOKEN"]response = requests.post( url, headers={ "Coder-Session-Token": token, }, json={ "id": 0, "inputs": { "property1": "string", "property2": "string", }, "owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05", },)print(response.status_code, response.text)package mainimport ( "fmt" "io" "net/http" "os" "strings")func main() { body := strings.NewReader(`{ "id": 0, "inputs": { "property1": "string", "property2": "string" }, "owner_id": "8826ee2e-7933-4665-aef2-2393f84a0d05"}`) url := os.Getenv("CODER_URL") + "/api/v2/templateversions/{templateversion}/dynamic-parameters/evaluate" token := os.Getenv("CODER_SESSION_TOKEN") req, err := http.NewRequest(http.MethodPost, url, body) if err != nil { panic(err) } req.Header.Set("Coder-Session-Token", token) req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() out, err := io.ReadAll(resp.Body) if err != nil { panic(err) } fmt.Println(resp.Status, string(out))}Example Response200
{ "diagnostics": [ { "detail": "string", "extra": { "code": "string" }, "severity": "error", "summary": "string" } ], "id": 0, "parameters": [ { "default_value": { "valid": true, "value": "string" }, "description": "string", "diagnostics": [ { "detail": "string", "extra": { "code": "string" }, "severity": "error", "summary": "string" } ], "display_name": "string", "ephemeral": true, "form_type": "", "icon": "string", "mutable": true, "name": "string", "options": [ { "description": "string", "icon": "string", "name": "string", "value": { "valid": true, "value": "string" } } ], "order": 0, "required": true, "styling": { "disabled": true, "label": "string", "mask_input": true, "placeholder": "string" }, "type": "string", "validations": [ { "validation_error": "string", "validation_max": 0, "validation_min": 0, "validation_monotonic": "string", "validation_regex": "string" } ], "value": { "valid": true, "value": "string" } } ]}