There are two APIs for adding a user to a role. In the first, you pass the role in the payload:
curl -H "Content-Type:application/xml" -u ADMIN:PWORD -X POST https://api.enterprise.apigee.com/v1/o/ORGNAME/users/USEREMAIL/userroles/ -d '<Roles><Role name="ROLENAME"/></Roles>'
In the second, you specify it in the request URL:
curl -H "Content-Type:application/x-www-form-urlencoded" -u ADMIN:PWORD -X POST https://api.enterprise.apigee.com/v1/o/ORGNAME/userroles/ROLENAME/users?id=USEREMAIL
Is one of these the preferred method?
Stephen
Solved! Go to Solution.
I prefer this @Stephen Gilson,
curl -H "Content-Type:application/x-www-form-urlencoded"-u ADMIN:PWORD -X POST https://api.enterprise.apigee.com/v1/o/ORGNAME/userroles/ROLENAME/users?id=USEREMAIL
reason - its convenient to add users to an org who already do not exist in the org
I prefer this @Stephen Gilson,
curl -H "Content-Type:application/x-www-form-urlencoded"-u ADMIN:PWORD -X POST https://api.enterprise.apigee.com/v1/o/ORGNAME/userroles/ROLENAME/users?id=USEREMAIL
reason - its convenient to add users to an org who already do not exist in the org
If you are a system admin, you can add user to a org and assign role to a user in single step :
curl -u SYSADMIN:SYSPWORD -X
POST https://api.enterprise.apigee.com/v1/users/USEREMAIL/userroles -d '{"role":[{"name":"orgadmin","organization”:"ORGNAME"}],"user":{"emailId”:"USEREMAIL","firstName”:"FirstName","lastName”:"LastName"}}