10-04-2022 06:57 AM
Good morning.
i have been trying to utilize the command runner api with the dnacentersdk.
i been following the tutorial here: https://blogs.cisco.com/developer/network-automation-cisco-dna-center-sdk-2
but the file does to download anywhere to my system, and i am not sure where to access it in DNA center.
here is the code i am using:
11-01-2022 11:39 AM
For me, to get it to download, I had to also use the save_file parameter and not specify a filename in the dirpath, like so:
cmd_output = dnac.file.download_a_file_by_fileid(task_progress['fileId'], save_file=True, dirpath="/Users/alexstev/Desktop/temp/")
When I ran the above code I can see the files created in the local folder
Here's how the docs explain those parameters:
download_a_file_by_fileid(file_id, dirpath=None, save_file=None, filename=None, headers=None, **request_parameters)[source]¶
Downloads a file specified by fileId.
Parameters
file_id (basestring) – File Identification number.
dirpath (basestring) – Directory absolute path. Defaults to os.getcwd().
save_file (bool) – Enable or disable automatic file creation of raw response.
filename (basestring) – The filename used to save the download file.
headers (dict) – Dictionary of HTTP Headers to send with the Request .
**request_parameters – Additional request parameters (provides support for parameters that may be added in the future).
source: https://dnacentersdk.readthedocs.io/en/latest/api/api.html
I'm not sure how (or even if) we can access that local file in the DNA Center GUI. You can try out the command runner in the GUI here: https://sandboxdnac.cisco.com/dna/tools/command-runner
You can also use the DevNet sandboxes for this. Currently, we have two DNA Center sandboxes. That's what I used.
https://devnetsandbox.cisco.com/RM/Topology
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