Class MerakiClient
A Meraki Dashboard API client. This is your starting point for all API operations. Example usage:
using Meraki.Api;
using System;
using System.Threading.Tasks;
namespace My.Project;
public static class Program
{
public static async Task Main()
{
using var merakiClient = new MerakiClient(
new MerakiClientOptions
{
ApiKey = "0123456789abcdef0123456789abcdef01234567",
UserAgent = "YourProductName/YourProductVersion YourCompanyName"
}
);
var organizations = await merakiClient
.Organizations
.GetOrganizationsAsync()
.ConfigureAwait(false);
var firstOrganization = organizations[0];
var devices = await merakiClient
.Organizations
.Devices
.GetOrganizationDevicesAsync(firstOrganization.Id)
.ConfigureAwait(false);
Console.WriteLine("Devices:");
foreach (var device in devices)
{
Console.WriteLine($" - {device.Serial}: {device.Name}");
}
}
}
public class MerakiClient : IDisposable
- Inheritance
-
MerakiClient
- Implements
- Inherited Members
Constructors
MerakiClient(MerakiClientOptions, ILogger?)
A Meraki portal client
public MerakiClient(MerakiClientOptions options, ILogger? logger = null)
Parameters
options
MerakiClientOptionslogger
ILogger
Properties
ApiClientVersion
public string ApiClientVersion { get; }
Property Value
Appliance
public ApplianceSection Appliance { get; }
Property Value
Camera
public CameraSection Camera { get; }
Property Value
CellularGateway
public CellularGatewaySection CellularGateway { get; }
Property Value
Devices
public DevicesSection Devices { get; }
Property Value
Insight
public InsightSection Insight { get; }
Property Value
IsReadOnly
Used to find out whether the client has the ReadOnly option set
public bool IsReadOnly { get; }
Property Value
LastRequestUri
public string LastRequestUri { get; }
Property Value
LastResponseHeaders
public HttpResponseHeaders? LastResponseHeaders { get; set; }
Property Value
Licensing
public LicensingSection Licensing { get; }
Property Value
LiveTools
public LiveToolsSection LiveTools { get; }
Property Value
Networks
public NetworksSection Networks { get; }
Property Value
Organizations
public OrganizationsSection Organizations { get; }
Property Value
Sensor
public SensorSection Sensor { get; }
Property Value
SensorRanges
public static Dictionary<SensorMetrics, List<SensorRange>> SensorRanges { get; }
Property Value
Sm
public SmSection Sm { get; }
Property Value
Statistics
public MerakiClientStatistics Statistics { get; }
Property Value
Switch
public SwitchSection Switch { get; }
Property Value
Wireless
public WirelessSection Wireless { get; }
Property Value
Methods
Dispose()
public void Dispose()
Dispose(bool)
protected virtual void Dispose(bool disposing)
Parameters
disposing
bool
GetAllAsync<T>(Func<int, string?, string?, CancellationToken, Task<List<T>>>, int, CancellationToken)
public Task<List<T>> GetAllAsync<T>(Func<int, string?, string?, CancellationToken, Task<List<T>>> pageFactoryAsync, int perPage, CancellationToken cancellationToken)
Parameters
pageFactoryAsync
Func<int, string, string, CancellationToken, Task<List<T>>>perPage
intcancellationToken
CancellationToken
Returns
Type Parameters
T
GetAllAsync<T>(Func<int?, string?, string?, CancellationToken, Task<ApiResponse<List<T>>>>, int, CancellationToken)
public static Task<List<T>> GetAllAsync<T>(Func<int?, string?, string?, CancellationToken, Task<ApiResponse<List<T>>>> pageFactoryAsync, int perPage, CancellationToken cancellationToken)
Parameters
pageFactoryAsync
Func<int?, string, string, CancellationToken, Task<ApiResponse<List<T>>>>perPage
intcancellationToken
CancellationToken
Returns
Type Parameters
T
GetAllAsync<T>(Func<string?, string?, CancellationToken, Task<ApiResponse<List<T>>>>, CancellationToken)
public static Task<List<T>> GetAllAsync<T>(Func<string?, string?, CancellationToken, Task<ApiResponse<List<T>>>> pageFactoryAsync, CancellationToken cancellationToken)
Parameters
pageFactoryAsync
Func<string, string, CancellationToken, Task<ApiResponse<List<T>>>>cancellationToken
CancellationToken
Returns
Type Parameters
T
GetAllAsync<T>(Func<string?, string?, CancellationToken, Task<List<T>>>, CancellationToken)
public Task<List<T>> GetAllAsync<T>(Func<string?, string?, CancellationToken, Task<List<T>>> pageFactoryAsync, CancellationToken cancellationToken)
Parameters
pageFactoryAsync
Func<string, string, CancellationToken, Task<List<T>>>cancellationToken
CancellationToken
Returns
Type Parameters
T
GetEndOfLifeDetailsAsync(CancellationToken)
Returns a list of end-of-life data Data regularly updated from https://documentation.meraki.com/General_Administration/Other_Topics/Meraki_End-of-Life_(EOL)_Products_and_Dates
public static Task<List<DeviceModelEndOfLifeDetail>> GetEndOfLifeDetailsAsync(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationToken
Returns
Exceptions
- ApiException
Thrown when fails to make API call
GetInfoFromSerialNumber(string)
Returns a list of end-of-life data Data regularly updated from https://documentation.meraki.com/General_Administration/Other_Topics/Meraki_End-of-Life_(EOL)_Products_and_Dates
public static SerialNumberInfo GetInfoFromSerialNumber(string serialNumber)
Parameters
serialNumber
string
Returns
SetReadOnly(bool)
Used to change the Options Readonly state after client is created
public void SetReadOnly(bool readOnly)
Parameters
readOnly
bool