Create template version dry-run
POST
CoderSessionTokenheader
Coder-Session-Token<token>templateversion*stringTemplate version ID
Format
uuidDry-run request
application/json- body
rich_parameter_values?array<>user_variable_values?array<>workspace_name?stringCreated
application/json- response
available_workers?array<>canceled_at?stringFormat
date-timecompleted_at?stringFormat
date-timecreated_at?stringFormat
date-timeerror?stringerror_code?stringValue in
"REQUIRED_TEMPLATE_VARIABLES""INSUFFICIENT_QUOTA"file_id?stringFormat
uuidid?stringFormat
uuidinitiator_id?stringFormat
uuidinput?logs_overflowed?booleanmetadata?organization_id?stringFormat
uuidqueue_position?integerqueue_size?integerstarted_at?stringFormat
date-timestatus?stringValue in
"pending""running""succeeded""canceling""canceled""failed"tags?type?codersdk.ProvisionerJobTypeValue in
"template_version_import""workspace_build""template_version_dry_run"worker_id?stringFormat
uuidworker_name?stringThe samples read CODER_URL and CODER_SESSION_TOKEN: set up your environment.
curl -X POST \ "$CODER_URL/api/v2/templateversions/{templateversion}/dry-run" \ -H "Coder-Session-Token: $CODER_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "rich_parameter_values": [ { "name": "string", "value": "string" } ], "user_variable_values": [ { "name": "string", "value": "string" } ], "workspace_name": "string"}'const { CODER_URL, CODER_SESSION_TOKEN } = process.env;const url = `${CODER_URL}/api/v2/templateversions/{templateversion}/dry-run`;const response = await fetch(url, { method: "POST", headers: { "Coder-Session-Token": CODER_SESSION_TOKEN, "Content-Type": "application/json", }, body: JSON.stringify({ rich_parameter_values: [ { name: "string", value: "string", }, ], user_variable_values: [ { name: "string", value: "string", }, ], workspace_name: "string", }),});console.log(response.status, await response.text());import osimport requestsurl = os.environ["CODER_URL"] + "/api/v2/templateversions/{templateversion}/dry-run"token = os.environ["CODER_SESSION_TOKEN"]response = requests.post( url, headers={ "Coder-Session-Token": token, }, json={ "rich_parameter_values": [ { "name": "string", "value": "string", }, ], "user_variable_values": [ { "name": "string", "value": "string", }, ], "workspace_name": "string", },)print(response.status_code, response.text)package mainimport ( "fmt" "io" "net/http" "os" "strings")func main() { body := strings.NewReader(`{ "rich_parameter_values": [ { "name": "string", "value": "string" } ], "user_variable_values": [ { "name": "string", "value": "string" } ], "workspace_name": "string"}`) url := os.Getenv("CODER_URL") + "/api/v2/templateversions/{templateversion}/dry-run" 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 Response201
{ "available_workers": [ "13308a9d-95c9-4c48-be18-6b7d335b5cea" ], "canceled_at": "2019-08-24T14:15:22Z", "completed_at": "2019-08-24T14:15:22Z", "created_at": "2019-08-24T14:15:22Z", "error": "string", "error_code": "REQUIRED_TEMPLATE_VARIABLES", "file_id": "8a0cfb4f-ddc9-436d-91bb-75133c583767", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "initiator_id": "06588898-9a84-4b35-ba8f-f9cbd64946f3", "input": { "error": "string", "template_version_id": "0ba39c92-1f1b-4c32-aa3e-9925d7713eb1", "workspace_build_id": "badaf2eb-96c5-4050-9f1d-db2d39ca5478" }, "logs_overflowed": true, "metadata": { "template_display_name": "string", "template_icon": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "template_name": "string", "template_version_name": "string", "workspace_build_transition": "start", "workspace_id": "0967198e-ec7b-4c6b-b4d3-f71244cadbe9", "workspace_name": "string" }, "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", "queue_position": 0, "queue_size": 0, "started_at": "2019-08-24T14:15:22Z", "status": "pending", "tags": { "property1": "string", "property2": "string" }, "type": "template_version_import", "worker_id": "ae5fa6f7-c55b-40c1-b40a-b36ac467652b", "worker_name": "string"}