03-13-2015 09:07 AM
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.
03-17-2015 02:17 AM
03-20-2015 02:23 AM
I believe the post gcheriais referring would be helpful. I have a python script around here that does fairly painlessly as well, let me see if I can locate and post the code.
03-25-2015 04:01 PM
Mark,
Sorry about the delay, Try the code I am posting below. 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
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide