Call this API to create dynamic search in NetBrain Domain Management - Site Manager.
Title : Create Dynamic Search API
Version : 03/08/2024
API Server URL : http(s)://IP address of NetBrain Web API Server/ServicesAPI/API/V1/CMDB/Sites/Leaf/DynamicSearch
Authentication :
Type | In | Name |
---|---|---|
Bearer Authentication | Headers | Authentication token |
Example
{
sitePath : "My Network/Unnamed-site1"
filter : {
"expression": "A and (b and C)",
"conditions": [
{
"schema": "subType",
"operator": 0,
"expression": "rootType"
},
{
"schema": "intfs.speed",
"operator": 4,
"expression": "1"
},
{
"expression": "False",
"operator": 0,
"schema": "hasEIGRPConfig",
"fieldType": 2
}
]
}
}
No parameters required.
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. |
Name | Type | Description |
---|---|---|
statusCode | integer | The returned status code of executing the API. |
statusDescription | string | The explanation of the status code. |
Example
{
'statusCode': 790200,
'statusDescription': 'Success'
}
# import python modules
import requests
import time
import urllib3
import pprint
import json
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
# Set the request inputs
token = '684c4e42-833a-428d-a5c9-3f047f3d3a67'
nb_url = "http://192.168.31.191"
full_url = nb_url + "/ServicesAPI/API/V1/CMDB/Sites/Leaf/DynamicSearch"
headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}
headers["Token"] = token
{
sitePath : "My Network/Unnamed-site1"
filter : {
"expression": "A and (b and C)",
"conditions": [
{
"schema": "subType",
"operator": 0,
"expression": "rootType"
},
{
"schema": "intfs.speed",
"operator": 4,
"expression": "1"
},
{
"expression": "False",
"operator": 0,
"schema": "hasEIGRPConfig",
"fieldType": 2
}
]
}
}
body = {
"sitePath": sitePath,
"filter" : filter
}
try:
response = requests.put(full_url, json.dumps(body), headers=headers, verify=False)
print(response)
if response.status_code == 200:
result = response.json()
print (result)
else:
print ("Failed to create dynamic search - " + str(response.text))
except Exception as e:
print (str(e))
{'statusCode': 790200, 'statusDescription': 'Success.'}
curl -X PUT \
http://192.168.31.191/ServicesAPI/API/V1/CMDB/Sites/Leaf/DynamicSearch \
-H "Content-Type: application/json"
-H 'token: db4363c3-2f5f-47da-bfc8-2d14b6992558' \
-d '{
"sitePath": "My Network/Unnamed-site1",
"filter" : {
"expression": "A and (b and C)",
"conditions": [
{
"schema": "subType",
"operator": 0,
"expression": "rootType"
},
{
"schema": "intfs.speed",
"operator": 4,
"expression": "1"
},
{
"expression": "False",
"operator": 0,
"schema": "hasEIGRPConfig",
"fieldType": 2
}
]
}
}'