Call this API to delete a user account from NetBrain system.
Title : Delete User API
Version : 02/01/2019.
API Server URL : http(s)://IP address of NetBrain Web API Server/ServicesAPI/API/V1/CMDB/Users
Authentication :
Type | In | Name |
---|---|---|
Bearer Authentication | Headers | Authentication token |
No request body.
Data Format Headers
Name | Type | Description |
---|---|---|
Content-Type | string | support "application/json" |
Accept | string | support "application/json" |
Authorization Headers
Name | Type | Description |
---|---|---|
token | string | Authentication token, get from login API. |
Example
#normal response:
{
'statusCode': 790200,
'statusDescription': 'Success.'
}
# response with duplicate user accounts in different server without aunthentication server provided in input.
{
"users": [
{
"authenticationServer": "NetBrain",
"userName": "user1"
},
{
"authenticationServer": "AD",
"userName": "user1"
}
],
"statusCode": 792032,
"statusDescription": "There are users with the same name 'user1' in the system,You need to specify the authentication server."
}
# import python modules
import requests
import time
import urllib3
import pprint
import json
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# Set the request inputs
token = "005fd6cc-cf08-4742-985b-902503dad2a4"
nb_url = "http://192.168.28.79"
username = "NetBrain1"
authenticationServer = "NetBrain"
full_url = nb_url + "/ServicesAPI/API/V1/CMDB/Users/" + str(username) + "/" + str(authenticationServer)
headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}
headers["Token"] = token
try:
response = requests.delete(full_url, headers = headers, verify = False)
if response.status_code == 200:
result = response.json()
print (result)
else:
print ("Delete user account failed! - " + str(response.text))
except Exception as e:
print (str(e))
{'statusCode': 790200, 'statusDescription': 'Success.'}
curl -X DELETE \
http://192.168.28.79/ServicesAPI/API/V1/CMDB/Users/Netbrain1/NetBrain \
-H 'Postman-Token: f303ba1f-55ab-43d8-9d39-d00e936a5ef5' \
-H 'cache-control: no-cache' \
-H 'token: 005fd6cc-cf08-4742-985b-902503dad2a4'