Ask Your Question

What is the curl equivalent to keystone user-role-add

asked 2013-09-14 10:45:33 -0500

anonymous user


I am trying to find out how to add a role to a user in openstack/keystone. I have been to the curl examples in openstack site but there doesn't seem to be enough information there to get the command right.

I have used the following command adding "role" as another parameter to adding a user. This seems to add an attribute "role" but I'm not sure it's considering it a real "role" :

curl -H 'X-Auth-Token: <token> ' -d '{"name":"test123","password":"secret.0","email":"","role":"admin","enabled":true}' https://localhost:35357/v2.0/user</token>

Thanks in advance.

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted

answered 2013-09-14 14:42:03 -0500

achampion gravatar image

updated 2013-09-14 14:42:31 -0500

In v2.0 you can only add a role for a user within a tenant. Adding a role is a PUT on /v2.0/tenants/{tenantId}/users/{userId}/roles/OS-KSADM/{roleId} You will need to find the id values for user, tenant and the admin role.

curl -X PUT -H 'X-Auth-Token:<token>' https://localhost:35357/v2.0/tenants/<tenantid>/users/<userid>/roles/OS-KSADM/<role-id>
edit flag offensive delete link more

answered 2013-09-15 18:59:26 -0500

jamielennox gravatar image

For future if you are looking for this sort of information the keystone CLI app has a --debug flag which will show you the HTTP traffic in both directions, and handily prints out the equivalent curl commands for your request.

edit flag offensive delete link more

Get to know Ask OpenStack

Resources for moderators

Question Tools


Asked: 2013-09-14 10:45:33 -0500

Seen: 779 times

Last updated: Sep 15 '13