Update workspace ACL
PATCH
CoderSessionTokenheader
Coder-Session-Token<token>workspace*stringWorkspace ID
Format
uuidUpdate workspace ACL request
application/json- body
group_roles?GroupRoles is a mapping from valid group UUIDs to the workspace role they should be granted. To remove a group from the workspace, use "" as the role (available as a constant named codersdk.WorkspaceRoleDeleted)
user_roles?UserRoles is a mapping from valid user UUIDs to the workspace role they should be granted. To remove a user from the workspace, use "" as the role (available as a constant named codersdk.WorkspaceRoleDeleted)
No Content
The samples read CODER_URL and CODER_SESSION_TOKEN: set up your environment.
curl -X PATCH \ "$CODER_URL/api/v2/workspaces/{workspace}/acl" \ -H "Coder-Session-Token: $CODER_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "group_roles": { "property1": "admin", "property2": "admin" }, "user_roles": { "property1": "admin", "property2": "admin" }}'const { CODER_URL, CODER_SESSION_TOKEN } = process.env;const url = `${CODER_URL}/api/v2/workspaces/{workspace}/acl`;const response = await fetch(url, { method: "PATCH", headers: { "Coder-Session-Token": CODER_SESSION_TOKEN, "Content-Type": "application/json", }, body: JSON.stringify({ group_roles: { property1: "admin", property2: "admin", }, user_roles: { property1: "admin", property2: "admin", }, }),});console.log(response.status, await response.text());import osimport requestsurl = os.environ["CODER_URL"] + "/api/v2/workspaces/{workspace}/acl"token = os.environ["CODER_SESSION_TOKEN"]response = requests.patch( url, headers={ "Coder-Session-Token": token, }, json={ "group_roles": { "property1": "admin", "property2": "admin", }, "user_roles": { "property1": "admin", "property2": "admin", }, },)print(response.status_code, response.text)package mainimport ( "fmt" "io" "net/http" "os" "strings")func main() { body := strings.NewReader(`{ "group_roles": { "property1": "admin", "property2": "admin" }, "user_roles": { "property1": "admin", "property2": "admin" }}`) url := os.Getenv("CODER_URL") + "/api/v2/workspaces/{workspace}/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))}Example Response204
Empty