Documentation
AdGuard.ApiClient.Api.DevicesApi
All URIs are relative to https://api.adguard-dns.io
| Method | HTTP request | Description |
|---|---|---|
| CreateDevice | POST /oapi/v1/devices | Creates a new device |
| GetDevice | GET /oapi/v1/devices/{device_id} | Gets an existing device by ID |
| ListDevices | GET /oapi/v1/devices | Lists devices |
| RemoveDevice | DELETE /oapi/v1/devices/{device_id} | Removes a device |
| UpdateDevice | PUT /oapi/v1/devices/{device_id} | Updates an existing device |
CreateDevice
Device CreateDevice (DeviceCreate deviceCreate)
Creates a new device
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 CreateDeviceExample
{
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 DevicesApi(httpClient, config, httpClientHandler);
var deviceCreate = new DeviceCreate(); // DeviceCreate |
try
{
// Creates a new device
Device result = apiInstance.CreateDevice(deviceCreate);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DevicesApi.CreateDevice: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Using the CreateDeviceWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Creates a new device
ApiResponse<Device> response = apiInstance.CreateDeviceWithHttpInfo(deviceCreate);
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 DevicesApi.CreateDeviceWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| deviceCreate | DeviceCreate |
Return type
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: /, application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | Device created | - |
| 400 | Validation failed | - |
| 429 | Devices count reached the limit | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetDevice
Device GetDevice (string deviceId)
Gets an existing device by ID
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 GetDeviceExample
{
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 DevicesApi(httpClient, config, httpClientHandler);
var deviceId = "deviceId_example"; // string |
try
{
// Gets an existing device by ID
Device result = apiInstance.GetDevice(deviceId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DevicesApi.GetDevice: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Using the GetDeviceWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Gets an existing device by ID
ApiResponse<Device> response = apiInstance.GetDeviceWithHttpInfo(deviceId);
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 DevicesApi.GetDeviceWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| deviceId | string |
Return type
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: /
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | Device info | - |
| 404 | Device not found | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
ListDevices
List<Device> ListDevices ()
Lists devices
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 ListDevicesExample
{
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 DevicesApi(httpClient, config, httpClientHandler);
try
{
// Lists devices
List<Device> result = apiInstance.ListDevices();
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DevicesApi.ListDevices: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Using the ListDevicesWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Lists devices
ApiResponse<List<Device>> response = apiInstance.ListDevicesWithHttpInfo();
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 DevicesApi.ListDevicesWithHttpInfo: " + 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 devices | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
RemoveDevice
void RemoveDevice (string deviceId)
Removes a device
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 RemoveDeviceExample
{
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 DevicesApi(httpClient, config, httpClientHandler);
var deviceId = "deviceId_example"; // string |
try
{
// Removes a device
apiInstance.RemoveDevice(deviceId);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DevicesApi.RemoveDevice: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Using the RemoveDeviceWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Removes a device
apiInstance.RemoveDeviceWithHttpInfo(deviceId);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DevicesApi.RemoveDeviceWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| deviceId | string |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: Not defined
- Accept: Not defined
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | Device deleted | - |
| 404 | Device not found | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]
UpdateDevice
void UpdateDevice (string deviceId, DeviceUpdate deviceUpdate)
Updates an existing device
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 UpdateDeviceExample
{
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 DevicesApi(httpClient, config, httpClientHandler);
var deviceId = "deviceId_example"; // string |
var deviceUpdate = new DeviceUpdate(); // DeviceUpdate |
try
{
// Updates an existing device
apiInstance.UpdateDevice(deviceId, deviceUpdate);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DevicesApi.UpdateDevice: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
}
}
}
Using the UpdateDeviceWithHttpInfo variant
This returns an ApiResponse object which contains the response data, status code and headers.
try
{
// Updates an existing device
apiInstance.UpdateDeviceWithHttpInfo(deviceId, deviceUpdate);
}
catch (ApiException e)
{
Debug.Print("Exception when calling DevicesApi.UpdateDeviceWithHttpInfo: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Parameters
| Name | Type | Description | Notes |
|---|---|---|---|
| deviceId | string | ||
| deviceUpdate | DeviceUpdate |
Return type
void (empty response body)
Authorization
HTTP request headers
- Content-Type: application/json
- Accept: application/json
HTTP response details
| Status code | Description | Response headers |
|---|---|---|
| 200 | Device updated | - |
| 400 | Validation failed | - |
| 404 | Device not found | - |
[Back to top] [Back to API list] [Back to Model list] [Back to README]