Cisco.DnaCenter.Api
1.0.0
Untuk menggunakan paket nuget Cisco DNA Center:
using Cisco . DnaCenter . Api ;
using System ;
using System . Collections . Generic ;
using System . Threading . Tasks ;
namespace My . Project
{
public static class Program
{
public static async Task Main ( )
{
var dnaCenterClient = new DnaCenterClient ( new DnaCenterClientOptions
{
Uri = new Uri ( " https://mydnac.example.com/ " ) ,
Username = " username " ,
Password = " password "
} ) ;
var sites = await dnaCenterClient
. Sites
. GetAllAsync ( )
. ConfigureAwait ( false ) ;
var firstSite = sites . Response [ 0 ] ;
var devicesResponse = await dnaCenterClient
. Devices
. GetAllAsync ( locationName : new List < string > { firstSite . SiteNameHierarchy } )
. ConfigureAwait ( false ) ;
Console . WriteLine ( " Devices: " ) ;
foreach ( var device in devicesResponse . Response )
{
Console . WriteLine ( $" - { device . SerialNumber } : { device . Hostname } " ) ;
}
}
}
}
Dokumentasi DNA Center Intent API dapat ditemukan di sini:
Anda dapat mengujinya menggunakan DNA Center Sandbox di sini:
Setelah masuk, lihat di sisi kiri bawah halaman untuk URL, nama pengguna, dan kata sandi Anda.