Cisco.DnaCenter.Api

Nuget
Codacy Badge

To use the Cisco DNA Center nuget package:

Visual Studio

  1. Open your project in Visual Studio
  2. Right-click on the project and click "Manage Nuget packages"
  3. Find the package "Cisco.DnaCenter.Api" - install the latest version

Example code (C# 8.0):

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}");
			}
		}
	}
}

API Documentation

The DNA Center Intent API documentation can be found here:

Testing

You can test this using a DNA Center Sandbox here:

After signing in, look in the lower left hand side of the page for your URL, username and password.

View code on GitHub

Code Exchange Community

Get help, share code, and collaborate with other developers in the Code Exchange community.View Community
Disclaimer:
Cisco provides Code Exchange for convenience and informational purposes only, with no support of any kind. This page contains information and links from third-party websites that are governed by their own separate terms. Reference to a project or contributor on this page does not imply any affiliation with or endorsement by Cisco.