Update a Role
Update a role given their roleId
.
caution
This endpoint has been deprecated and will be phased out at the end of 2023. Please update any existing usages of it to use the Update Object endpoint instead.
Endpoint
PUT /v1/roles/:roleId
Parameters
Parameter | Description | Type | Required |
---|---|---|---|
roleId | The id of the role to update. Note that id cannot be changed. | URL param | yes |
name | An optional, display-friendly name for the role. | JSON body | no |
description | An optional description of the role. A useful description might include a summary of the permissions the role grants. | JSON body | no |
Note: Optional fields that are omitted will clear existing values.
Request
- cURL
- Go
- Java
- Node.js
- Python
- Ruby
- PHP
- CLI
curl "https://api.warrant.dev/v1/roles/admin" \
-X PUT \
-H "Authorization: ApiKey YOUR_KEY" \
--data-raw \
'{ "name": "Administrator", description: "Grants a user admin access to the application" }'
updatedRole, err := role.Update("admin", &role.RoleParams{
Meta: map[string]interface{}{
"name": "Administrator",
"description": "Grants a user admin access to the application",
},
})
try {
Map<String, Object> roleMeta = new HashMap<String, Object>();
roleMeta.put("name", "Administrator");
roleMeta.put("description", "Grants a user admin access to the application");
Role updatedRole = client.updateRole("admin", new Role("admin", roleMeta));
} catch (WarrantException e) {
// Handle error
}
const updatedRole = await warrantClient.Role.update("admin", {
name: "Administrator",
description: "Grants a user admin access to the application",
});
role = warrant.Role.get("admin")
role.update({"name": "Administrator", "description": "Grants a user admin access to the application"})
# Class method
updated_role = Warrant::Role.update("admin", { name: "Administrator", description: "Grants a user admin access to the application" })
# Instance method
role = Warrant::Role.get("admin")
role.update({ name: "Administrator", description: "Grants a user admin access to the application" })
Response
{
"roleId": "admin",
"name": "Administrator",
"description": "Grants a user admin access to the application"
}