← Back to Documentation
Documentation
AdGuard.ApiClient.Api.DedicatedIPAddressesApi
All URIs are relative to https://api.adguard-dns.io
| Method | HTTP request | Description |
|---|---|---|
| AllocateDedicatedIPv4Address | POST /oapi/v1/dedicated_addresses/ipv4 | Allocates new dedicated IPv4 |
| ListDedicatedIPv4Addresses | GET /oapi/v1/dedicated_addresses/ipv4 | Lists allocated dedicated IPv4 addresses |
AllocateDedicatedIPv4Address
DedicatedIPv4Address AllocateDedicatedIPv4Address ()
Allocates new dedicated IPv4
Example
using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Http;
using AdGuard.ApiClient.Api;
using AdGuard.ApiClient.Client;
using AdGuard.ApiClient.Model;
namespace Example
{
public class AllocateDedicatedIPv4AddressExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.adguard-dns.io";
// Configure API key authorization: ApiKey
config.AddApiKey("Authorization", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("Authorization", "Bearer");
// Configure Bearer token for authorization: AuthToken
config.AccessToken = "YOUR_BEARER_TOKEN";
// create instances of HttpClient, HttpClientHandler to be reused later with different Api classes
HttpClient httpClient = new HttpClient();
HttpClientHandler httpClientHandler = new HttpClientHandler();
var apiInstance = new DedicatedIPAddressesApi(httpClient, config, httpClientHandler);
try
{
// Allocates new dedicated IPv4
DedicatedIPv4Address result = apiInstance.AllocateDedicatedIPv4Address();
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DedicatedIPAddressesApi.AllocateDedicatedIPv4Address: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Using the AllocateDedicatedIPv4AddressWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Allocates new dedicated IPv4
ApiResponse<DedicatedIPv4Address> response = apiInstance.AllocateDedicatedIPv4AddressWithHttpInfo();
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DedicatedIPAddressesApi.AllocateDedicatedIPv4AddressWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Parameters
This endpoint does not need any parameter.
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: /
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | New IPv4 successfully allocated | - |
| 429 | Dedicated IPv4 count reached the limit | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ListDedicatedIPv4Addresses
List<DedicatedIPv4Address> ListDedicatedIPv4Addresses ()
Lists allocated dedicated IPv4 addresses
Example
using System.Collections.Generic;
using System.Diagnostics;
using System.Net.Http;
using AdGuard.ApiClient.Api;
using AdGuard.ApiClient.Client;
using AdGuard.ApiClient.Model;
namespace Example
{
public class ListDedicatedIPv4AddressesExample
{
public static void Main()
{
Configuration config = new Configuration();
config.BasePath = "https://api.adguard-dns.io";
// Configure API key authorization: ApiKey
config.AddApiKey("Authorization", "YOUR_API_KEY");
// Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
// config.AddApiKeyPrefix("Authorization", "Bearer");
// Configure Bearer token for authorization: AuthToken
config.AccessToken = "YOUR_BEARER_TOKEN";
// create instances of HttpClient, HttpClientHandler to be reused later with different Api classes
HttpClient httpClient = new HttpClient();
HttpClientHandler httpClientHandler = new HttpClientHandler();
var apiInstance = new DedicatedIPAddressesApi(httpClient, config, httpClientHandler);
try
{
// Lists allocated dedicated IPv4 addresses
List<DedicatedIPv4Address> result = apiInstance.ListDedicatedIPv4Addresses();
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DedicatedIPAddressesApi.ListDedicatedIPv4Addresses: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Using the ListDedicatedIPv4AddressesWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Lists allocated dedicated IPv4 addresses
ApiResponse<List<DedicatedIPv4Address>> response = apiInstance.ListDedicatedIPv4AddressesWithHttpInfo();
Debug.Write("Status Code: " + response.StatusCode);
Debug.Write("Response Headers: " + response.Headers);
Debug.Write("Response Body: " + response.Data);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DedicatedIPAddressesApi.ListDedicatedIPv4AddressesWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Parameters
This endpoint does not need any parameter.
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: /
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | List of dedicated IPv4 addresses | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]