Community Articles
Find and share helpful community-sourced technical articles
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.
Labels (1)

1. Create User

[root@chupa1 ~]# curl -iv -u admin:admin -H "X-Requested-By: ambari" -X POST -d '{"Users/user_name":"dav","Users/password":"pass","Users/active":"true","Users/admin":"false"}' http://localhost:8080/api/v1/users 
* About to connect() to localhost port 8080 (#0) 
* Trying ::1... connected 
* Connected to localhost (::1) port 8080 (#0) 
* Server auth using Basic with user 'admin' 
> POST /api/v1/users HTTP/1.1 
> Authorization: Basic YWRtaW46YWRtaW4= 
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.16.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2 
> Host: localhost:8080 
> Accept: */* 
> X-Requested-By: ambari 
> Content-Length: 93 
> Content-Type: application/x-www-form-urlencoded 
> 
< HTTP/1.1 201 Created 
HTTP/1.1 201 Created 

2. Create Group

[root@chupa1 ~]# curl -iv -u admin:admin -H "X-Requested-By: ambari" -X POST -d '{"Groups/group_name":"davgroup"}' http://localhost:8080/api/v1/groups 
* About to connect() to localhost port 8080 (#0) 
* Trying ::1... connected 
* Connected to localhost (::1) port 8080 (#0) 
* Server auth using Basic with user 'admin' 
> POST /api/v1/groups HTTP/1.1 
> Authorization: Basic YWRtaW46YWRtaW4= 
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.16.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2 
> Host: localhost:8080 
> Accept: */* 
> X-Requested-By: ambari 
> Content-Length: 32 
> Content-Type: application/x-www-form-urlencoded 
> 
< HTTP/1.1 201 Created 
HTTP/1.1 201 Created 

3. Map user to Group

[root@chupa1 ~]# curl -iv -u admin:admin -H "X-Requested-By: ambari" -X POST -d '{"MemberInfo/user_name":"dav", "MemberInfo/group_name":"davgroup"}' http://localhost:8080/api/v1/groups/davgroup/members 
* About to connect() to localhost port 8080 (#0) 
* Trying ::1... connected 
* Connected to localhost (::1) port 8080 (#0) 
* Server auth using Basic with user 'admin' 
> POST /api/v1/groups/davgroup/members HTTP/1.1 
> Authorization: Basic YWRtaW46YWRtaW4= 
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.16.1 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2 
> Host: localhost:8080 
> Accept: */* 
> X-Requested-By: ambari 
> Content-Length: 66 
> Content-Type: application/x-www-form-urlencoded 
> 
< HTTP/1.1 201 Created 
HTTP/1.1 201 Created
1,197 Views
Comments
New Contributor

can you guide me how to create a read-only user by ambari rest api

New Contributor

How to assign privileges to a group when it is created?

Don't have an account?
Coming from Hortonworks? Activate your account here
Version history
Revision #:
1 of 1
Last update:
‎02-10-2017 11:16 PM
Updated by:
 
Contributors
Top Kudoed Authors