Here are practical examples demonstrating how to manage roles using the Nova API, including creating, assigning, and retrieving role information.
🔧 Example 1: Creating a Role
curl -X POST http://localhost:8774/v2.1/os-roles \
-H "Content-Type: application/json" \
-H "X-Auth-Token: <your_token>" \
-d '{
"role": {
"name": "custom_admin"
}
}'
🧾 Example 2: Assigning a Role to a User
curl -X POST http://localhost:8774/v2.1/users/<user_id>/roles \
-H "Content-Type: application/json" \
-H "X-Auth-Token: <your_token>" \
-d '{
"role": {
"name": "custom_admin"
}
}'
📊 Example 3: Listing All Roles
curl -X GET http://localhost:8774/v2.1/os-roles \
-H "X-Auth-Token: <your_token>"
📁 Reference
For detailed parameters and endpoints, see the Nova API Role Management Guide.