Skip to content

Latest commit

 

History

History
111 lines (77 loc) · 2.74 KB

File metadata and controls

111 lines (77 loc) · 2.74 KB

Topology API Design

Call this API to build or rebuild the Layer 3 topology for all network devices in a domain.

Note that, in a domain scope, only one topology build task can run at any time.

Detail Information

Title : Build L3 Topology API

Version : 02/01/2019.

API Server URL : http(s)://IP address of NetBrain Web API Server/ServicesAPI/API/V1/CMDB/Topology/Tasks/L3

Authentication :

Type In Name
Bearer Authentication Headers Authentication token

Request body(*required)

No request body.

Parameters(*required)

No parameters required.

Headers

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.

Response

Name Type Description
taskId string The task Id. It can be used to query task status.
statusCode integer The returned status code of executing the API.
statusDescription string The explanation of the status code.

Example

{
    "taskId": "710e42d5-cc90-49bc-9f92-7e743251ae01",
    "statusCode": 790200,
    "statusDescription": "Success."
}

Full Example:

# 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/L3"
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': 'd4923460-5ce1-45e3-b9a5-d410fd13fa37', 'statusCode': 790200, 'statusDescription': 'Success.'}

cURL Code from Postman:

curl -X POST \
  http://192.168.28.79/ServicesAPI/API/V1/CMDB/Topology/Tasks/L3 \
  -H 'Postman-Token: 95aec067-bc7d-4be0-9d07-e789d2996d6a' \
  -H 'cache-control: no-cache' \
  -H 'token: 3d0f475d-dbae-4c44-9080-7b08ded7d35b'