Update template ACL
CoderSessionTokenCoder-Session-Token<token>template*stringTemplate ID
uuidUpdate template ACL request
application/json- body
group_perms?GroupPerms is a mapping from valid group UUIDs to the template role they should be granted. To remove a group from the template, use "" as the role (available as a constant named codersdk.TemplateRoleDeleted)
user_perms?UserPerms is a mapping from valid user UUIDs to the template role they should be granted. To remove a user from the template, use "" as the role (available as a constant named codersdk.TemplateRoleDeleted)
OK
application/json- response
detail?stringDetail is a debug message that provides further insight into why the action failed. This information can be technical and a regular golang err.Error() text.
- "database: too many open connections"
- "stat: too many open files"
message?stringMessage is an actionable message that depicts actions the request took. These messages should be fully formed sentences with proper punctuation. Examples:
- "A user has been created."
- "Failed to create a user."
validations?array<>Validations are form field-specific friendly error messages. They will be shown on a form field in the UI. These can also be used to add additional context if there is a set of errors in the primary 'Message'.
The samples read CODER_URL and CODER_SESSION_TOKEN: set up your environment.
curl -X PATCH \ "$CODER_URL/api/v2/templates/{template}/acl" \ -H "Coder-Session-Token: $CODER_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "group_perms": { "8bd26b20-f3e8-48be-a903-46bb920cf671": "use", "<group_id>": "admin" }, "user_perms": { "4df59e74-c027-470b-ab4d-cbba8963a5e9": "use", "<user_id>": "admin" }}'const { CODER_URL, CODER_SESSION_TOKEN } = process.env;const url = `${CODER_URL}/api/v2/templates/{template}/acl`;const response = await fetch(url, { method: "PATCH", headers: { "Coder-Session-Token": CODER_SESSION_TOKEN, "Content-Type": "application/json", }, body: JSON.stringify({ group_perms: { "8bd26b20-f3e8-48be-a903-46bb920cf671": "use", "<group_id>": "admin", }, user_perms: { "4df59e74-c027-470b-ab4d-cbba8963a5e9": "use", "<user_id>": "admin", }, }),});console.log(response.status, await response.text());import osimport requestsurl = os.environ["CODER_URL"] + "/api/v2/templates/{template}/acl"token = os.environ["CODER_SESSION_TOKEN"]response = requests.patch( url, headers={ "Coder-Session-Token": token, }, json={ "group_perms": { "8bd26b20-f3e8-48be-a903-46bb920cf671": "use", "<group_id>": "admin", }, "user_perms": { "4df59e74-c027-470b-ab4d-cbba8963a5e9": "use", "<user_id>": "admin", }, },)print(response.status_code, response.text)package mainimport ( "fmt" "io" "net/http" "os" "strings")func main() { body := strings.NewReader(`{ "group_perms": { "8bd26b20-f3e8-48be-a903-46bb920cf671": "use", "<group_id>": "admin" }, "user_perms": { "4df59e74-c027-470b-ab4d-cbba8963a5e9": "use", "<user_id>": "admin" }}`) url := os.Getenv("CODER_URL") + "/api/v2/templates/{template}/acl" 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))}{ "detail": "string", "message": "string", "validations": [ { "detail": "string", "field": "string" } ]}