cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

1363
Views
0
Helpful
7
Replies
m.batts
Enthusiast

Deleting Unity Connection Users

Just looking at deleting a user from unity connection.

From what I can see it only allows you to delete based on object id rather that alias etc.

Am I missing something?  as it seems a massive pain to get all the details and then have to sort through them to then get the valid object id.

7 REPLIES 7
m.batts
Enthusiast

Apologies posted in the wrong.

I assume you're talking about using the REST API or ODBC interface to identify and delete a user?

The objectId is the unique identifier for a user and is thus required when doing something as drastic as deleting a user (and their corresponding messages etc...).

You can use the Bulk User Delete Tool if you'd rather:

http://www.ciscounitytools.com/Applications/CxN/BulkUserDelete/BulkUserDelete.html

you can provide lists via CSV, find them by a number of criteria, generate dependency reports (i.e. what links to this user will be broken when they're removed) and such in addition to bulk deleting users.

Thanks for the reply , yes I was looking at deleting the user via the REST API.

I'm looking to automate the deletion process so will be provided and alias for which I wlll then delete.

Looks like i'll have to dump everything out and then do a search.

Thanks for the info

You can go about getting the objectid a bit easier than that. Query for the alias like so:

https://<server>/vmrest/users/?query=(alias is <ALIAS>)

The resulting XML will give you the objectid. You can also use startswith.

jocreed
Cisco Employee

Yeah I think this also on another post, I will post a script that is a good example of how to accomplish this.

jocreed
Cisco Employee

I put this on the other thread as well.  Provide any feed back you have about the code sample.  Let me know if this ended up being useful for you.  Thank You

System Specs are Windows 7, Python 2.7.9, using Requests external library Requests: HTTP for Humans — Requests 2.6.0 documentation.

This is a simple base code that should get you started.  Let me know if you have questions.

Base Code Sample:

import requests

import json

#HTTP headers to include

UserHeaders = {'Accept':'application/json', 'content-type':'application/json','connection':'keep_alive'}

#define Alias to be removed

userAlias = 'Alias''

#Define your Unity connection server URL here

UCURL = 'https://<UnityServer>/vmrest/users/?query=(alias is ' + userAlias + ')'

#Forming the request using "Request" library to submit to the server.

ObIDGetResponse = requests.get(UCURL, headers=UserHeaders, auth=('AppUser','password'), verify=False)

#Using the json dot notation call to get the JSON response from the server in a dictionary format for Python to process

UserGet = UserCreationResponse.json()

#Extracting the specific value from the dictionary using the defined keys from the JSON response

UserObId = UserGet['User']['ObjectId']

#Printing the Object ID to console

print UserObId

#Definining the URL used to delete the user

deleteURL = 'https://<UnityServer>/vmrest/users/' + UserObId

#Forming the Delete request using the "Requests" library

UltimateDestruction = requests.delete(deleteURL, headers=UserHeaders, auth=('AppUser', 'password'), verify=False)

#Printing the HTTP response from the server to console

print UltimateDestruction

with above code, i am getting  that object ID and it was passing to remove the unity user from unity connection. After command i get response that command has been successfully executed. but when i check into Unity connection. User is still there. It is local user to unity connection. Is it take time to disappear ?

Out put

<Response [200]>

25dbb51e-4bb5-45d3-9104-b19ad5045aca

http://10.XXX.XXX.XXX/vmrest/users/25dbb51e-4bb5-45d3-9104-b19ad5045aca

Warning (from warnings module):

  File "C:\Python34\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 821

    InsecureRequestWarning)

InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html

<Response [200]>

25dbb51e-4bb5-45d3-9104-b19ad5045aca

http://10.XXX.XXX.XXX/vmrest/users/25dbb51e-4bb5-45d3-9104-b19ad5045aca

<Response [200]>

>>>

Create
Recognize Your Peers
Content for Community-Ad