Open fatman00 opened 2 years ago
Hey @fatman00 could you please active debug and show me more details?.
Here's detail how to bring debug on: https://dnacentersdk.readthedocs.io/en/latest/api/quickstart.html#configuring-logging-for-dnacentersdk
Thanks
Hi @fmunozmiranda I have now redone the test, and it seems to work whenever I create a fabric site. But I get the above error when I try to create a fabric-site that already exist. I think this is a user error.
If I use another of the methods: get_sda_fabric_count() it gives me an error. If I run the following code:
from dnacentersdk import api
dnac = api.DNACenterAPI(username="devnet",
password="C1sco1234",
base_url="https://172.26.1.11:443",
version='2.2.3.3',
verify=False,
debug=True)
task = dnac.sda.get_sda_fabric_count()
print(task)
I get this error:
python ./test.py
2022-09-14 14:37:25,081 - simple_example - DEBUG - simple message
Attempt 1
Request
URL: https://172.26.1.11:443/dna/intent/api/v1/business/sda/fabric/count
Method: GET
Headers:
User-Agent: python-requests/2.28.1
Accept-Encoding: gzip, deflate
Accept: */*
Connection: keep-alive
X-Auth-Token: eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2MzE0ZmQ2ZjY1MDUzNTRiM2RmYWUyYWYiLCJhdXRoU291cmNlIjoiaW50ZXJuYWwiLCJ0ZW5hbnROYW1lIjoiVE5UMCIsInJvbGVzIjpbIjYxMDA3ZjkzNTY1Y2Y0MDBjMDcwOGQzYiJdLCJ0ZW5hbnRJZCI6IjYxMDA3ZjkyNTY1Y2Y0MDBjMDcwOGQzOSIsImV4cCI6MTY2MzE2MjY0NSwiaWF0IjoxNjYzMTU5MDQ1LCJqdGkiOiI3ZDg0M2ZjYy02ZGYxLTQwNWUtOGM3YS0wYTE5NTk5MGE1MmMiLCJ1c2VybmFtZSI6ImRldm5ldCJ9.T0vG7aj2xSlv-0e5rYoNW3K4OxIAdytZ118XtllKXcVe2308D3qbePd7zoCSLfNFd0M2PaG_2RYasePqOLUsyzLJCnLC8QKbmSwAkVoF3j99jtYTieNu6B7nP4aoXVv8gp86NnhMhEqk8fEy6-gJT1_WX-iWQmbrx1jGmGOYZUDCit2JL8XCwyy5TWkOb6V23EWO3due1QaxY4jtCkRcsipwU29r6K_3ZvSW-cHnthovtZrEGHsRnlwixIUMkFRWb-iikdAE1X7kZWxhenQQH9KsWSmaSpte3YJEzFU29l2c50LL1Fm1S1kQgj72BjoqAjYFkIWDlAIJMkE0gOJDZA
Content-type: application/json;charset=utf-8
Params:
{}
Response
Status: 404 - Not Found
Headers:
Content-Type: application/json
Content-Length: 100
Connection: keep-alive
Server: webserver
Date: Wed, 14 Sep 2022 12:37:25 GMT
x-request-id: a8c29ecd0fb8b9d53b14149218b62cb0
Vary: Origin
Access-Control-Allow-Origin: dnac.dna.das-i.dk
Via: api-gateway
Cache-Control: no-store
Pragma: no-cache
Content-Security-Policy: default-src 'self' 'unsafe-inline' 'unsafe-eval' blob: data:
X-Content-Type-Options: nosniff
X-XSS-Protection: 1
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-Frame-Options: SAMEORIGIN
Body:
{
"error": "BAPI not found with technicalName /v1/business/sda/fabric/count and restMethod GET"
}
Traceback (most recent call last):
File "./test.py", line 44, in <module>
task = dnac.sda.get_sda_fabric_count()
File "C:\Users\rael\Documents\Coding\DNAC-sdk\.venv\lib\site-packages\dnacentersdk\api\v2_2_3_3\sda.py", line 1507, in get_sda_fabric_count
json_data = self._session.get(endpoint_full_url, params=_params)
File "C:\Users\rael\Documents\Coding\DNAC-sdk\.venv\lib\site-packages\dnacentersdk\restsession.py", line 550, in get
response = self.request('GET', url, erc, 0, params=params, **kwargs)
File "C:\Users\rael\Documents\Coding\DNAC-sdk\.venv\lib\site-packages\dnacentersdk\restsession.py", line 471, in request
check_response_code(response, erc)
File "C:\Users\rael\Documents\Coding\DNAC-sdk\.venv\lib\site-packages\dnacentersdk\utils.py", line 209, in check_response_code
raise ApiError(response)
dnacentersdk.exceptions.ApiError: [404] Not Found - The URI requested is invalid or the resource requested, such as a user, does not exist. Also returned when the requested format is not supported by the requested method.
Prerequisites
When trying to get the sda fabric count and creating a new fabric site the SDK fails with an HTTP error 400
Cannot test the fabric count from the DNAC GUI as it is not on the list, but have tested the POST:fabric-site endpoint and I am able to create a fabric site using it on the DNAC GUI. API endpoint: /dna/intent/api/v1/business/sda/fabric-site request body: { "fabricName": "Default LAN Fabric", "siteNameHierarchy": "Global/EMEA/Denmark/Aarhus/Tangen9, 8200" }
Screenshots
Environment (please complete the following information): 2..2.3.6 Python 3.8.2 dnacentersdk==2.5.4 Windows 10
Additional context
Error code: