Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]

Community Articles

Find and share helpful community-sourced technical articles.
Announcements
Share your experience with Cloudera on G2 and get a $25 Amazon Gift card.
Hi, I'm CLEO! Something exciting is coming to the Community. Stay Tuned!
Labels (1)
avatar

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
4,568 Views
Comments

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

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

Version history
Last update:
‎02-10-2017 11:16 PM
Updated by:
Contributors