How to create a user with admin role using RESTMAN?
book
Article ID: 425519
calendar_today
Updated On:
Products
CA API Developer Portal
CA API Gateway
CA Mobile API Gateway
Layer7 API Security
Issue/Introduction
I would like to create a user and assign the admin role for that user by using RESTMAN in API Gateway.
Resolution
- Create a user by posting the below data using REST API
- RESTMAN URL: https://<GATEWAY_HOST>:8443/restman/1.0/users (POST)
- Data: <l7:User providerId="0000000000000000fffffffffffffffe" xmlns:l7="http://ns.l7tech.com/2010/04/gateway-management">
<l7:Login>test_user</l7:Login>
<l7:Password>user-password</l7:Password>
<l7:Properties>
<l7:Property key="accountExpiration">
<l7:LongValue>-1</l7:LongValue>
</l7:Property>
<l7:Property key="enabled">
<l7:BooleanValue>true</l7:BooleanValue>
</l7:Property>
<l7:Property key="name">
<l7:StringValue>test_user</l7:StringValue>
</l7:Property>
</l7:Properties>
</l7:User>
- Verify the user is created and available by logging into the policy manager or via REST API call
- Assign admin role by using this data vis REST API
- RESTMAN URL: https://<GATEWAY_HOST>:8443/restman/1.0/roles/0000000000000000ffffffffffffff9c/assignments (PUT)
- Data: <l7:AddAssignmentsContext xmlns:l7="http://ns.l7tech.com/2010/04/gateway-management">
<l7:assignments>
<l7:assignment>
<l7:providerId>0000000000000000fffffffffffffffe</l7:providerId>
<l7:identityName>test_user</l7:identityName>
<l7:entityType>User</l7:entityType>
</l7:assignment>
</l7:assignments>
</l7:AddAssignmentsContext>
- Verify the role for the user by logging into the policy manager and viewing the user properties
Feedback
thumb_up
Yes
thumb_down
No