Call this API to build or rebuild the Layer 2 topology for all network devices in a domain.
Note that, in a domain scope, only one topology build task can run at any time.
Title : Build L2 Topology API
Version : 02/01/2019.
API Server URL : http(s)://IP address of NetBrain Web API Server/ServicesAPI/API/V1/CMDB/Topology/Tasks/L2
Authentication :
Type | In | Name |
---|---|---|
Bearer Authentication | Headers | Authentication token |
No request body.
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. |
Example
{
"taskId": "ae33ffb1-8d31-4f80-af7b-76ba69234923",
"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 = "3d0f475d-dbae-4c44-9080-7b08ded7d35b"
nb_url = "http://192.168.28.79"
full_url = nb_url + "/ServicesAPI/API/V1/CMDB/Topology/Tasks/L2"
headers = {'Content-Type': 'application/json', 'Accept': 'application/json'}
headers["Token"] = token
try:
response = requests.post(full_url, headers = headers, verify = False)
if response.status_code == 200:
result = response.json()
print (result)
else:
print ("Build L2 topology failed! - " + str(response.text))
except Exception as e:
print (str(e))
{'taskId': '594646ad-0de9-48f1-8877-47eff03897f0', 'statusCode': 790200, 'statusDescription': 'Success.'}
curl -X POST \
http://192.168.28.79/ServicesAPI/API/V1/CMDB/Topology/Tasks/L2 \
-H 'Postman-Token: d2d08056-5a9c-41b0-a0e6-ab98e251fc70' \
-H 'cache-control: no-cache' \
-H 'token: 3d0f475d-dbae-4c44-9080-7b08ded7d35b'