Class InfluxDBClient
Inheritance
Namespace: InfluxDB.Client
Assembly: InfluxDB.Client.dll
Syntax
public class InfluxDBClient : AbstractRestClient, IInfluxDBClient, IDisposable
Constructors
InfluxDBClient(InfluxDBClientOptions)
Create a instance of the InfluxDB 2.x client.
Declaration
public InfluxDBClient(InfluxDBClientOptions options)
Parameters
Type | Name | Description |
---|---|---|
InfluxDBClientOptions | options | the connection configuration |
InfluxDBClient(String)
Create a instance of the InfluxDB 2.x client. The url could be a connection string with various configurations.
e.g.: "http://localhost:8086?timeout=5000&logLevel=BASIC The following options are supported:
Declaration
public InfluxDBClient(string url)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | connection string with various configurations |
InfluxDBClient(String, String)
Create a instance of the InfluxDB 2.x client.
Declaration
public InfluxDBClient(string url, string token)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | the url to connect to the InfluxDB 2.x |
System.String | token | the token to use for the authorization |
InfluxDBClient(String, String, String)
Create a instance of the InfluxDB 2.x client.
Declaration
public InfluxDBClient(string url, string username, string password)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | the url to connect to the InfluxDB 2.x |
System.String | username | the username to use in the basic auth |
System.String | password | the password to use in the basic auth |
InfluxDBClient(String, String, String, String, String)
Create a instance of the InfluxDB 2.x client to connect into InfluxDB 1.8.
Declaration
public InfluxDBClient(string url, string username, string password, string database, string retentionPolicy)
Parameters
Type | Name | Description |
---|---|---|
System.String | url | the url to connect to the InfluxDB 1.8 |
System.String | username | authorization username |
System.String | password | authorization password |
System.String | database | database name |
System.String | retentionPolicy | retention policy |
Methods
CreateService<TS>(Type)
Create a service for specified type.
Declaration
public TS CreateService<TS>(Type serviceType)
where TS : IApiAccessor
Parameters
Type | Name | Description |
---|---|---|
Type | serviceType | type of service |
Returns
Type | Description |
---|---|
TS | new instance of service |
Type Parameters
Name | Description |
---|---|
TS | type of service |
DisableGzip()
Disable Gzip compress for http request body.
Declaration
public InfluxDBClient DisableGzip()
Returns
Type | Description |
---|---|
InfluxDBClient | this |
Dispose()
Declaration
public void Dispose()
EnableGzip()
Enable Gzip compress for http requests.
Currently only the "Write" and "Query" endpoints supports the Gzip compression.
Declaration
public InfluxDBClient EnableGzip()
Returns
Type | Description |
---|---|
InfluxDBClient |
GetAuthorizationsApi()
Get the Authorization client.
Declaration
public AuthorizationsApi GetAuthorizationsApi()
Returns
Type | Description |
---|---|
AuthorizationsApi | the new client instance for Authorization API |
GetBucketsApi()
Get the Bucket client.
Declaration
public BucketsApi GetBucketsApi()
Returns
Type | Description |
---|---|
BucketsApi | the new client instance for Bucket API |
GetChecksApi()
Get the Check client.
Declaration
public ChecksApi GetChecksApi()
Returns
Type | Description |
---|---|
ChecksApi | the new client instance for Checks API |
GetDeleteApi()
Get the Delete client.
Declaration
public DeleteApi GetDeleteApi()
Returns
Type | Description |
---|---|
DeleteApi | the new client instance for Delete API |
GetInvokableScriptsApi(IDomainObjectMapper)
Create an InvokableScripts API instance.
Declaration
public InvokableScriptsApi GetInvokableScriptsApi(IDomainObjectMapper mapper = null)
Parameters
Type | Name | Description |
---|---|---|
IDomainObjectMapper | mapper | the mapper used for mapping invocation results to POCO |
Returns
Type | Description |
---|---|
InvokableScriptsApi | New instance of InvokableScriptsApi. |
GetLabelsApi()
Get the Label client.
Declaration
public LabelsApi GetLabelsApi()
Returns
Type | Description |
---|---|
LabelsApi | the new client instance for Label API |
GetLogLevel()
Set the LogLevel that is used for logging requests and responses.
Declaration
public LogLevel GetLogLevel()
Returns
Type | Description |
---|---|
LogLevel | Log Level |
GetNotificationEndpointsApi()
Get the NotificationEndpoint client.
Declaration
public NotificationEndpointsApi GetNotificationEndpointsApi()
Returns
Type | Description |
---|---|
NotificationEndpointsApi | the new client instance for NotificationEndpoint API |
GetNotificationRulesApi()
Get the NotificationRules client.
Declaration
public NotificationRulesApi GetNotificationRulesApi()
Returns
Type | Description |
---|---|
NotificationRulesApi | the new client instance for NotificationRules API |
GetOrganizationsApi()
Get the Organization client.
Declaration
public OrganizationsApi GetOrganizationsApi()
Returns
Type | Description |
---|---|
OrganizationsApi | the new client instance for Organization API |
GetQueryApi(IDomainObjectMapper)
Get the Query client.
Declaration
public QueryApi GetQueryApi(IDomainObjectMapper mapper = null)
Parameters
Type | Name | Description |
---|---|---|
IDomainObjectMapper | mapper | the mapper used for mapping FluxResults to POCO |
Returns
Type | Description |
---|---|
QueryApi | the new client instance for the Query API |
GetQueryApiSync(IDomainObjectMapper)
Get the synchronous version of Query client.
Declaration
public QueryApiSync GetQueryApiSync(IDomainObjectMapper mapper = null)
Parameters
Type | Name | Description |
---|---|---|
IDomainObjectMapper | mapper | the mapper used for mapping FluxResults to POCO |
Returns
Type | Description |
---|---|
QueryApiSync | the new synchronous client instance for the Query API |
GetScraperTargetsApi()
Get the ScraperTargetResponse client.
Declaration
public ScraperTargetsApi GetScraperTargetsApi()
Returns
Type | Description |
---|---|
ScraperTargetsApi | the new client instance for Scraper API |
GetSourcesApi()
Get the Source client.
Declaration
public SourcesApi GetSourcesApi()
Returns
Type | Description |
---|---|
SourcesApi | the new client instance for Source API |
GetTasksApi()
Get the TaskType client.
Declaration
public TasksApi GetTasksApi()
Returns
Type | Description |
---|---|
TasksApi | the new client instance for Task API |
GetTelegrafsApi()
Get the Telegraf client.
Declaration
public TelegrafsApi GetTelegrafsApi()
Returns
Type | Description |
---|---|
TelegrafsApi | the new client instance for Telegrafs API |
GetUsersApi()
Get the User client.
Declaration
public UsersApi GetUsersApi()
Returns
Type | Description |
---|---|
UsersApi | the new client instance for User API |
GetWriteApi(IDomainObjectMapper)
Get the Write client.
Declaration
public WriteApi GetWriteApi(IDomainObjectMapper mapper = null)
Parameters
Type | Name | Description |
---|---|---|
IDomainObjectMapper | mapper | the mapper used for mapping to PointData |
Returns
Type | Description |
---|---|
WriteApi | the new client instance for the Write API |
GetWriteApi(WriteOptions, IDomainObjectMapper)
Get the Write client.
Declaration
public WriteApi GetWriteApi(WriteOptions writeOptions, IDomainObjectMapper mapper = null)
Parameters
Type | Name | Description |
---|---|---|
WriteOptions | writeOptions | the configuration for a write client |
IDomainObjectMapper | mapper | the converter used for mapping to PointData |
Returns
Type | Description |
---|---|
WriteApi | the new client instance for the Write API |
GetWriteApiAsync(IDomainObjectMapper)
Get the Write async client.
Declaration
public WriteApiAsync GetWriteApiAsync(IDomainObjectMapper mapper = null)
Parameters
Type | Name | Description |
---|---|---|
IDomainObjectMapper | mapper | the converter used for mapping to PointData |
Returns
Type | Description |
---|---|
WriteApiAsync | the new client instance for the Write API Async without batching |
HealthAsync()
Get the health of an instance.
Declaration
public Task<HealthCheck> HealthAsync()
Returns
Type | Description |
---|---|
Task<HealthCheck> | health of an instance |
IsGzipEnabled()
Returns whether Gzip compress for http request body is enabled.
Declaration
public bool IsGzipEnabled()
Returns
Type | Description |
---|---|
System.Boolean | true if gzip is enabled. |
IsOnboardingAllowedAsync()
Check if database has default user, org, bucket created, returns true if not.
Declaration
public async Task<bool> IsOnboardingAllowedAsync()
Returns
Type | Description |
---|---|
Task<System.Boolean> | True if onboarding has already been completed otherwise false |
OnboardingAsync(OnboardingRequest)
Post onboarding request, to setup initial user, org and bucket.
Declaration
public Task<OnboardingResponse> OnboardingAsync(OnboardingRequest onboarding)
Parameters
Type | Name | Description |
---|---|---|
OnboardingRequest | onboarding | to setup defaults |
Returns
Type | Description |
---|---|
Task<OnboardingResponse> | defaults for first run |
Exceptions
Type | Condition |
---|---|
HttpException | With status code 422 when an onboarding has already been completed |
PingAsync()
Check the status of InfluxDB Server.
Declaration
public async Task<bool> PingAsync()
Returns
Type | Description |
---|---|
Task<System.Boolean> | true if server is healthy otherwise return false |
ReadyAsync()
Check the readiness of InfluxDB Server at startup. It is not supported by InfluxDB Cloud.
Declaration
public async Task<Ready> ReadyAsync()
Returns
Type | Description |
---|---|
Task<Ready> | return null if the InfluxDB is not ready |
SetLogLevel(LogLevel)
Set the log level for the request and response information.
Declaration
public void SetLogLevel(LogLevel logLevel)
Parameters
Type | Name | Description |
---|---|---|
LogLevel | logLevel | the log level to set |
VersionAsync()
Return the version of the connected InfluxDB Server.
Declaration
public async Task<string> VersionAsync()
Returns
Type | Description |
---|---|
Task<System.String> | the version String, otherwise unknown |
Exceptions
Type | Condition |
---|---|
InfluxException | throws when request did not succesfully ends |
Explicit Interface Implementations
IInfluxDBClient.DisableGzip()
Disable Gzip compress for http request body.
Declaration
IInfluxDBClient IInfluxDBClient.DisableGzip()
Returns
Type | Description |
---|---|
IInfluxDBClient | this |
IInfluxDBClient.EnableGzip()
Enable Gzip compress for http requests.
Currently only the "Write" and "Query" endpoints supports the Gzip compression.
Declaration
IInfluxDBClient IInfluxDBClient.EnableGzip()
Returns
Type | Description |
---|---|
IInfluxDBClient |
IInfluxDBClient.GetAuthorizationsApi()
Get the Authorization client.
Declaration
IAuthorizationsApi IInfluxDBClient.GetAuthorizationsApi()
Returns
Type | Description |
---|---|
IAuthorizationsApi | the new client instance for Authorization API |
IInfluxDBClient.GetBucketsApi()
Get the Bucket client.
Declaration
IBucketsApi IInfluxDBClient.GetBucketsApi()
Returns
Type | Description |
---|---|
IBucketsApi | the new client instance for Bucket API |
IInfluxDBClient.GetChecksApi()
Get the Check client.
Declaration
IChecksApi IInfluxDBClient.GetChecksApi()
Returns
Type | Description |
---|---|
IChecksApi | the new client instance for Checks API |
IInfluxDBClient.GetDeleteApi()
Get the Delete client.
Declaration
IDeleteApi IInfluxDBClient.GetDeleteApi()
Returns
Type | Description |
---|---|
IDeleteApi | the new client instance for Delete API |
IInfluxDBClient.GetInvokableScriptsApi(IDomainObjectMapper)
Create an InvokableScripts API instance.
Declaration
IInvokableScriptsApi IInfluxDBClient.GetInvokableScriptsApi(IDomainObjectMapper mapper)
Parameters
Type | Name | Description |
---|---|---|
IDomainObjectMapper | mapper | the mapper used for mapping invocation results to POCO |
Returns
Type | Description |
---|---|
IInvokableScriptsApi | New instance of InvokableScriptsApi. |
IInfluxDBClient.GetLabelsApi()
Get the Label client.
Declaration
ILabelsApi IInfluxDBClient.GetLabelsApi()
Returns
Type | Description |
---|---|
ILabelsApi | the new client instance for Label API |
IInfluxDBClient.GetNotificationEndpointsApi()
Get the NotificationEndpoint client.
Declaration
INotificationEndpointsApi IInfluxDBClient.GetNotificationEndpointsApi()
Returns
Type | Description |
---|---|
INotificationEndpointsApi | the new client instance for NotificationEndpoint API |
IInfluxDBClient.GetNotificationRulesApi()
Get the NotificationRules client.
Declaration
INotificationRulesApi IInfluxDBClient.GetNotificationRulesApi()
Returns
Type | Description |
---|---|
INotificationRulesApi | the new client instance for NotificationRules API |
IInfluxDBClient.GetOrganizationsApi()
Get the Organization client.
Declaration
IOrganizationsApi IInfluxDBClient.GetOrganizationsApi()
Returns
Type | Description |
---|---|
IOrganizationsApi | the new client instance for Organization API |
IInfluxDBClient.GetQueryApi(IDomainObjectMapper)
Get the Query client.
Declaration
IQueryApi IInfluxDBClient.GetQueryApi(IDomainObjectMapper mapper)
Parameters
Type | Name | Description |
---|---|---|
IDomainObjectMapper | mapper | the mapper used for mapping FluxResults to POCO |
Returns
Type | Description |
---|---|
IQueryApi | the new client instance for the Query API |
IInfluxDBClient.GetQueryApiSync(IDomainObjectMapper)
Get the synchronous version of Query client.
Declaration
IQueryApiSync IInfluxDBClient.GetQueryApiSync(IDomainObjectMapper mapper)
Parameters
Type | Name | Description |
---|---|---|
IDomainObjectMapper | mapper | the mapper used for mapping FluxResults to POCO |
Returns
Type | Description |
---|---|
IQueryApiSync | the new synchronous client instance for the Query API |
IInfluxDBClient.GetScraperTargetsApi()
Get the ScraperTargetResponse client.
Declaration
IScraperTargetsApi IInfluxDBClient.GetScraperTargetsApi()
Returns
Type | Description |
---|---|
IScraperTargetsApi | the new client instance for Scraper API |
IInfluxDBClient.GetSourcesApi()
Get the Source client.
Declaration
ISourcesApi IInfluxDBClient.GetSourcesApi()
Returns
Type | Description |
---|---|
ISourcesApi | the new client instance for Source API |
IInfluxDBClient.GetTasksApi()
Get the TaskType client.
Declaration
ITasksApi IInfluxDBClient.GetTasksApi()
Returns
Type | Description |
---|---|
ITasksApi | the new client instance for Task API |
IInfluxDBClient.GetTelegrafsApi()
Get the Telegraf client.
Declaration
ITelegrafsApi IInfluxDBClient.GetTelegrafsApi()
Returns
Type | Description |
---|---|
ITelegrafsApi | the new client instance for Telegrafs API |
IInfluxDBClient.GetUsersApi()
Get the User client.
Declaration
IUsersApi IInfluxDBClient.GetUsersApi()
Returns
Type | Description |
---|---|
IUsersApi | the new client instance for User API |
IInfluxDBClient.GetWriteApi(IDomainObjectMapper)
Get the Write client.
Declaration
IWriteApi IInfluxDBClient.GetWriteApi(IDomainObjectMapper mapper)
Parameters
Type | Name | Description |
---|---|---|
IDomainObjectMapper | mapper | the mapper used for mapping to PointData |
Returns
Type | Description |
---|---|
IWriteApi | the new client instance for the Write API |
IInfluxDBClient.GetWriteApi(WriteOptions, IDomainObjectMapper)
Get the Write client.
Declaration
IWriteApi IInfluxDBClient.GetWriteApi(WriteOptions writeOptions, IDomainObjectMapper mapper)
Parameters
Type | Name | Description |
---|---|---|
WriteOptions | writeOptions | the configuration for a write client |
IDomainObjectMapper | mapper | the converter used for mapping to PointData |
Returns
Type | Description |
---|---|
IWriteApi | the new client instance for the Write API |
IInfluxDBClient.GetWriteApiAsync(IDomainObjectMapper)
Get the Write async client.
Declaration
IWriteApiAsync IInfluxDBClient.GetWriteApiAsync(IDomainObjectMapper mapper)
Parameters
Type | Name | Description |
---|---|---|
IDomainObjectMapper | mapper | the converter used for mapping to PointData |
Returns
Type | Description |
---|---|
IWriteApiAsync | the new client instance for the Write API Async without batching |