diff --git a/Meraki.Api/Data/ApiRegion.cs b/Meraki.Api/Data/ApiRegion.cs
new file mode 100644
index 00000000..015288ca
--- /dev/null
+++ b/Meraki.Api/Data/ApiRegion.cs
@@ -0,0 +1,15 @@
+namespace Meraki.Api.Data;
+public enum ApiRegion
+{
+ ///
+ /// The default region for the Meraki Dashboard API
+ /// This uses the "api.meraki.com" endpoint
+ ///
+ Default,
+
+ ///
+ /// The China region for the Meraki Dashboard API
+ /// This uses the "api.meraki.cn" endpoint
+ ///
+ China
+}
diff --git a/Meraki.Api/MerakiClient.cs b/Meraki.Api/MerakiClient.cs
index de6f6b45..a5ee7731 100644
--- a/Meraki.Api/MerakiClient.cs
+++ b/Meraki.Api/MerakiClient.cs
@@ -22,8 +22,6 @@ public partial class MerakiClient : IDisposable
///
/// A Meraki portal client
///
- ///
- ///
public MerakiClient(MerakiClientOptions options, ILogger? logger = default)
{
var apiClientVersion = new System.Version(ThisAssembly.AssemblyFileVersion);
@@ -34,7 +32,14 @@ public MerakiClient(MerakiClientOptions options, ILogger? logger = default)
_httpClientHandler = new AuthenticatedBackingOffHttpClientHandler(options ?? throw new ArgumentNullException(nameof(options)), this, _logger);
_httpClient = new HttpClient(_httpClientHandler)
{
- BaseAddress = new Uri($"https://{options.ApiNode ?? "api"}.meraki.com/api/v1"),
+ BaseAddress = new Uri(
+ options.ApiRegion switch
+ {
+ ApiRegion.Default => $"https://{options.ApiNode ?? "api"}.meraki.com/api/v1",
+ ApiRegion.China => $"https://{options.ApiNode ?? "api"}.meraki.cn/api/v1",
+ _ => throw new ArgumentOutOfRangeException($"Unsupported API Region {options.ApiRegion}")
+ }
+ ),
Timeout = TimeSpan.FromSeconds(options.HttpClientTimeoutSeconds)
};
_refitSettings = new RefitSettings
diff --git a/Meraki.Api/MerakiClientOptions.cs b/Meraki.Api/MerakiClientOptions.cs
index beaa798f..2d0e9c49 100644
--- a/Meraki.Api/MerakiClientOptions.cs
+++ b/Meraki.Api/MerakiClientOptions.cs
@@ -5,6 +5,13 @@
///
public class MerakiClientOptions
{
+ ///
+ /// The API Region.
+ /// Defaults to "World", which is the default region for the Meraki Dashboard API.
+ /// Only change this if you are using the China API endpoint.
+ ///
+ public ApiRegion ApiRegion { get; set; } = ApiRegion.Default;
+
///
/// The API Node (e.g. "n72").
/// This is optional, but highly recommended as directly addressing the correct instance will reduce propagation delays.