Create a Role
Create a new role.
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 Create Object endpoint instead.
Endpoint
POST /v1/roles
Parameters
Parameter | Description | Type | Required |
---|---|---|---|
roleId | A string identifier for the role. A roleId must be composed of alphanumeric chars and/or _ , - , . , @ , | , and : . | JSON body | 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 |
Request
- cURL
- Go
- Java
- Node.js
- Python
- Ruby
- PHP
- CLI
curl "https://api.warrant.dev/v1/roles" \
-X POST \
-H "Authorization: ApiKey YOUR_KEY" \
--data-raw \
'{
"roleId": "customer-success",
"name": "Customer Success",
"description": "Grants read-only access to customer accounts"
}'
createdRole, err := role.Create(&warrant.RoleParams{
RoleId: "customer-success",
Name: "Customer Success",
Description: "Grants read-only access to customer accounts",
})
if err != nil {
// handle error
}
try {
Map<String, Object> roleMeta = new HashMap<String, Object>();
roleMeta.put("name", "Customer Success");
roleMeta.put("description", "Grants read-only access to customer accounts");
Role newRole = client.createRole(new Role(
"customer-success",
roleMeta
));
} catch (WarrantException e) {
// Handle error
}
const newRole = await warrantClient.Role.create({
roleId: "customer-success",
meta: {
name: "Customer Success",
description: "Grants read-only access to customer accounts",
}
});
role = warrant.Role.create("customer-success", {"name": "Customer Success", "description": "Grants read-only access to customer accounts"})
role = Warrant::Role.create({
role_id: "customer-success",
meta: {
name: "Customer Success",
description: "Grants read-only access to customer accounts"
}
})
$role = $warrant->createRole(new \Warrant\Role("customer-success", "Customer Success", "Grants read-only access to customer accounts"));
warrant create role customer-success
Response
{
"roleId": "customer-success",
"name": "Customer Success",
"description": "Grants read-only access to customer accounts"
}