Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

How to delete Ambari User by using the Ambari API

avatar
Contributor

Hello Guys,

For automatization processes, i want to remove/delete an existing Ambari User using the Ambari API

The Following command creates just the Error Message: 405 not allowed

+ curl -ik -admin:admin -H 'X-Requested-By: ambari' -X DELETE -d '{"Users/user_name":"user1"}' https://node0.mynet:8443/api/v1/users
HTTP/1.1 405 Method Not Allowed
Strict-Transport-Security: max-age=31536000
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
Set-Cookie: AMBARISESSIONID=390k4yb9us9z1f2elr2vq8kxg;Path=/;Secure;HttpOnly
Expires: Thu, 01 Jan 1970 00:00:00 GMT
User: admin
Allow: HEAD,POST,GET,OPTIONS
Content-Length: 0
Server: Jetty(8.1.19.v20160209)

How can i archive that?

At some Point, while experimenting, i was asked for the password of the user i want to delete, but that sounds unclever.

I am the Admin,i cannot be asked for the users Password. Especially in the use case, where the user left the project or company earlier.

Any Ideas?

best Regards,

Normen

1 ACCEPTED SOLUTION

avatar
Contributor

Jay, works like a charm. Thanks very much!

View solution in original post

6 REPLIES 6

avatar
Master Mentor

@Normen Zoch

Try this for deleting "user1"

curl -ik -u admin:admin -H 'X-Requested-By: ambari' -X DELETE  https://node0.mynet:8443/api/v1/users/user1

.

You were trying to pass a data "-d '{"Users/user_name":"user1"}'" which is a post data ... that is not right combination with DELETE request for the uri "/api/v1/users/"

.

For adding new users or adding privileges please refer to

https://cwiki.apache.org/confluence/pages/viewpage.action?pageId=55152242

https://community.hortonworks.com/questions/50073/adding-new-ambari-user-with-assigned-group-with-ap...

avatar
Contributor

Jay, works like a charm. Thanks very much!

avatar
Master Mentor

@Normen Zoch

Great to hear that the issue is resolved. It will be good if you can mark this HCC thread as Answered (Accepted) so that it will be useful for others as well.

avatar
Master Mentor

@Normen Zoch

You accepted an update which is not an answer. But just a confirmation that the issue got resolved :(

avatar
Contributor

Then i have no clue how to make this whole thread "Answered or Accepted". The only thing i got here is a wee gear in the right upper corner and there is just "report". Your answer i can only "share" or "Reward user",

not accept or answered. Can you point me to the Field, Link or whatever i need to click?

Thanks,

Normen

avatar
Expert Contributor