Patch template version by ID
PATCH
CoderSessionTokenheader
Coder-Session-Token<token>templateversion*stringTemplate version ID
Format
uuidPatch template version request
application/json- body
message?stringname?stringOK
application/json- response
archived?booleancreated_at?stringFormat
date-timecreated_by?has_external_agent?booleanid?stringFormat
uuidjob?matched_provisioners?message?stringname?stringorganization_id?stringFormat
uuidreadme?stringtemplate_id?stringFormat
uuidupdated_at?stringFormat
date-timewarnings?array<>The samples read CODER_URL and CODER_SESSION_TOKEN: set up your environment.
curl -X PATCH \ "$CODER_URL/api/v2/templateversions/{templateversion}" \ -H "Coder-Session-Token: $CODER_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "message": "string", "name": "string"}'const { CODER_URL, CODER_SESSION_TOKEN } = process.env;const url = `${CODER_URL}/api/v2/templateversions/{templateversion}`;const response = await fetch(url, { method: "PATCH", headers: { "Coder-Session-Token": CODER_SESSION_TOKEN, "Content-Type": "application/json", }, body: JSON.stringify({ message: "string", name: "string", }),});console.log(response.status, await response.text());import osimport requestsurl = os.environ["CODER_URL"] + "/api/v2/templateversions/{templateversion}"token = os.environ["CODER_SESSION_TOKEN"]response = requests.patch( url, headers={ "Coder-Session-Token": token, }, json={ "message": "string", "name": "string", },)print(response.status_code, response.text)package mainimport ( "fmt" "io" "net/http" "os" "strings")func main() { body := strings.NewReader(`{ "message": "string", "name": "string"}`) url := os.Getenv("CODER_URL") + "/api/v2/templateversions/{templateversion}" token := os.Getenv("CODER_SESSION_TOKEN") req, err := http.NewRequest(http.MethodPatch, 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
{ "archived": true, "created_at": "2019-08-24T14:15:22Z", "created_by": { "avatar_url": "http://example.com", "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "name": "string", "username": "string" }, "has_external_agent": true, "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "job": { "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" }, "matched_provisioners": { "available": 0, "count": 0, "most_recently_seen": "2019-08-24T14:15:22Z" }, "message": "string", "name": "string", "organization_id": "7c60d51f-b44e-4682-87d6-449835ea4de6", "readme": "string", "template_id": "c6d67e98-83ea-49f0-8812-e4abae2b68bc", "updated_at": "2019-08-24T14:15:22Z", "warnings": [ "UNSUPPORTED_WORKSPACES" ]}