ā04-24-2024 12:35 PM
Hi,
we have this fresh install of DNA Center 2.3.5.5-70026. I've been able to create areas using the Intent API but I can't create a building.
sitePath = "/dna/intent/api/v1/site"
headers = {'content-type': 'application/json'}
headers["X-Auth-Token"] = get_token()
headers['__runsync'] = 'true'
headers['__runsynctimeout'] = '30'
site_building = {
"type": "building",
"site": {
"building": {
"name": "TestBuilding",
"address":"London",
"parentName": "Global/EMEA"
}
}
}
response = requests.post(dnaCluster + sitePath, headers=headers, json=site_building, verify=False)
print(response.text)
Result:
{
"executionId" : "b75e0b7b-84db-4788-bc98-57d75cdf084e",
"statusCode" : 500,
"errorResponse" : {
"bapiErrorResponse" : {
"bapiKey" : "50b5-89fd-4c7a-930a",
"bapiName" : "Create Site",
"bapiErrorCode" : "",
"bapiErrorMessage" : ""
},
"componentErrorResponse" : [ {
"compId" : "uuid4b784701",
"compName" : "GET Location info",
"compErrorCode" : "500",
"compErrorMessage" : "sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target",
"componentType" : "REST_CLIENT"
} ]
}
}
Any idea on how to troubleshoot this any further?
Thanks,
Matteo
ā04-24-2024 01:58 PM
@MatteoComisso50310 Please follow the API docs. There are required parameters that have not been provided. The address must be a real street address
Example of params required:
```
building_info:
name: LO
address: 5400 Meadows Rd, Lake Oswego, Oregon 97035, United States
lat: 45.41676
long: -122.73312
```
Example of working payload:
```
building_payload = {
'type': 'building',
'site': {
'building': {
'name': building_name,
'parentName': 'Global/' + area_name,
'address': building_address,
'latitude': building_lat,
'longitude': building_long
}
}
}
```
ā04-24-2024 02:07 PM
Hi @Gabriel Zapodeanu ,
thanks, but it didn't work.
site_building = {
"type": "building",
"site": {
"building": {
"name": "LO",
"address":"5400 Meadows Rd, Lake Oswego, Oregon 97035, United States",
"parentName": "Global/EMEA",
"latitude": "45.41676",
"longitude": "-122.73312"
}
}
}
Same as before:
{
"executionId" : "e46d9b14-372d-47c8-b5ac-c7a2f7c463a2",
"statusCode" : 500,
"errorResponse" : {
"bapiErrorResponse" : {
"bapiKey" : "50b5-89fd-4c7a-930a",
"bapiName" : "Create Site",
"bapiErrorCode" : "",
"bapiErrorMessage" : ""
},
"componentErrorResponse" : [ {
"compId" : "uuid4b784701",
"compName" : "GET Location info",
"compErrorCode" : "500",
"compErrorMessage" : "sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target",
"componentType" : "REST_CLIENT"
} ]
}
}
Can you provide a link to the documentation? This is what I've followed and doesn't provide many details: Create Site - Cisco Catalyst Center 2.3.7 - Cisco DevNet
Thanks,
Matteo
ā04-24-2024 07:48 PM
Matteo,
Here are an example of API Requests that I just ran in my cluster to demonstrate adding an:
- Area
- Building
- Floor
DESIGN.HIERARCHY - (Create AREA - "Area1-API") - API TOOLKIT
------------------------------------------------------------
POST
{{PROTOCOL}}://{{CATC.IP.ADDRESS}}/dna/intent/api/v1/site
BODY
{
"type": "AREA",
"site": {
"area": {
"name": "Area1-API",
"parentName": "Global"
}
}
}
DESIGN.HIERARCHY - (Create BUILDING - "Building1-API") - API TOOLKIT
--------------------------------------------------------------------
POST
{{PROTOCOL}}://{{CATC.IP.ADDRESS}}/dna/intent/api/v1/site
BODY
{
"type": "BUILDING",
"site": {
"area": {
"name": "Area1-API",
"parentName": "Global"
},
"building": {
"name": "Building1-API",
"address": "175 West Tasman Drive, San Jose, California 95134, United States",
"parentName": "Global/Area1-API",
"latitude": "37.4096",
"longitude": "-121.951577"
}
}
}
DESIGN.HIERARCHY - (Create FLOOR- "Floor1-API") - API TOOLKIT
--------------------------------------------------------------------
POST
{{PROTOCOL}}://{{CATC.IP.ADDRESS}}/dna/intent/api/v1/site
BODY
{
"type": "FLOOR",
"site": {
"area": {
"name": "Area1-API",
"parentName": "Global"
},
"building": {
"name": "Building1-API",
"address": "150 West Tasman Drive, San Jose, California 95134, United States",
"parentName": "Global/Area1-API",
"latitude": "37.40803",
"longitude": "-121.952639"
},
"floor": {
"name": "Floor1-API",
"parentName": "Building1-API",
"rfModel": "Free Space",
"width": "100",
"length": "100",
"height": "10"
}
}
}
ā04-24-2024 02:12 PM
This will give you more details about the Site APIs: https://developer.cisco.com/docs/dna-center/sites/#site-api
Catalyst Center has the API docs under:
Menu --> Platform --> Developer Toolkit --> APIs
ā04-24-2024 02:18 PM
API tested in my lab:
ā04-24-2024 10:04 PM
Hi,
thanks but I keep on getting the same error. I'd say it's not a payload issue, since the same payload works for you.
"compName" : "GET Location info",
"compErrorCode" : "500",
"compErrorMessage" : "sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target",
What is this error about? It mentions "certification path" and made me think that we have an outbound transparent proxy that performs SSL decryption. I've already installed the CA certificate in the DNA following the Cisco DNA Center Administrator Guide, Release 2.3.4 - Configure System Settings [Cisco Catalyst Center] - Cisco.
I can create buildings from GUI, so I don't think it's about the proxy, but still I tried. Any idea what that error is about?
Thanks,
Matteo
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