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 |
---|---|---|
Influx |
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. |
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. |
url | the url to connect to the InfluxDB 2.x |
System. |
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. |
url | the url to connect to the InfluxDB 2.x |
System. |
username | the username to use in the basic auth |
System. |
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. |
url | the url to connect to the InfluxDB 1.8 |
System. |
username | authorization username |
System. |
password | authorization password |
System. |
database | database name |
System. |
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 |
---|---|
Influx |
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 |
---|---|
Influx |
GetAuthorizationsApi()
Get the Authorization client.
Declaration
public AuthorizationsApi GetAuthorizationsApi()
Returns
Type | Description |
---|---|
Authorizations |
the new client instance for Authorization API |
GetBucketsApi()
Get the Bucket client.
Declaration
public BucketsApi GetBucketsApi()
Returns
Type | Description |
---|---|
Buckets |
the new client instance for Bucket API |
GetChecksApi()
Get the Check client.
Declaration
public ChecksApi GetChecksApi()
Returns
Type | Description |
---|---|
Checks |
the new client instance for Checks API |
GetDeleteApi()
Get the Delete client.
Declaration
public DeleteApi GetDeleteApi()
Returns
Type | Description |
---|---|
Delete |
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 |
---|---|---|
IDomain |
mapper | the mapper used for mapping invocation results to POCO |
Returns
Type | Description |
---|---|
Invokable |
New instance of InvokableScriptsApi. |
GetLabelsApi()
Get the Label client.
Declaration
public LabelsApi GetLabelsApi()
Returns
Type | Description |
---|---|
Labels |
the new client instance for Label API |
GetLogLevel()
Set the Log
Declaration
public LogLevel GetLogLevel()
Returns
Type | Description |
---|---|
Log |
Log Level |
GetNotificationEndpointsApi()
Get the Notification
Declaration
public NotificationEndpointsApi GetNotificationEndpointsApi()
Returns
Type | Description |
---|---|
Notification |
the new client instance for NotificationEndpoint API |
GetNotificationRulesApi()
Get the Notification
Declaration
public NotificationRulesApi GetNotificationRulesApi()
Returns
Type | Description |
---|---|
Notification |
the new client instance for NotificationRules API |
GetOrganizationsApi()
Get the Organization client.
Declaration
public OrganizationsApi GetOrganizationsApi()
Returns
Type | Description |
---|---|
Organizations |
the new client instance for Organization API |
GetQueryApi(IDomainObjectMapper)
Get the Query client.
Declaration
public QueryApi GetQueryApi(IDomainObjectMapper mapper = null)
Parameters
Type | Name | Description |
---|---|---|
IDomain |
mapper | the mapper used for mapping FluxResults to POCO |
Returns
Type | Description |
---|---|
Query |
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 |
---|---|---|
IDomain |
mapper | the mapper used for mapping FluxResults to POCO |
Returns
Type | Description |
---|---|
Query |
the new synchronous client instance for the Query API |
GetScraperTargetsApi()
Get the Scraper
Declaration
public ScraperTargetsApi GetScraperTargetsApi()
Returns
Type | Description |
---|---|
Scraper |
the new client instance for Scraper API |
GetSourcesApi()
Get the Source client.
Declaration
public SourcesApi GetSourcesApi()
Returns
Type | Description |
---|---|
Sources |
the new client instance for Source API |
GetTasksApi()
Get the Task
Declaration
public TasksApi GetTasksApi()
Returns
Type | Description |
---|---|
Tasks |
the new client instance for Task API |
GetTelegrafsApi()
Get the Telegraf client.
Declaration
public TelegrafsApi GetTelegrafsApi()
Returns
Type | Description |
---|---|
Telegrafs |
the new client instance for Telegrafs API |
GetUsersApi()
Get the User client.
Declaration
public UsersApi GetUsersApi()
Returns
Type | Description |
---|---|
Users |
the new client instance for User API |
GetWriteApi(IDomainObjectMapper)
Get the Write client.
Declaration
public WriteApi GetWriteApi(IDomainObjectMapper mapper = null)
Parameters
Type | Name | Description |
---|---|---|
IDomain |
mapper | the mapper used for mapping to PointData |
Returns
Type | Description |
---|---|
Write |
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 |
---|---|---|
Write |
writeOptions | the configuration for a write client |
IDomain |
mapper | the converter used for mapping to PointData |
Returns
Type | Description |
---|---|
Write |
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 |
---|---|---|
IDomain |
mapper | the converter used for mapping to PointData |
Returns
Type | Description |
---|---|
Write |
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<Health |
health of an instance |
IsGzipEnabled()
Returns whether Gzip compress for http request body is enabled.
Declaration
public bool IsGzipEnabled()
Returns
Type | Description |
---|---|
System. |
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. |
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 |
---|---|---|
Onboarding |
onboarding | to setup defaults |
Returns
Type | Description |
---|---|
Task<Onboarding |
defaults for first run |
Exceptions
Type | Condition |
---|---|
Http |
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. |
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 |
---|---|---|
Log |
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. |
the version String, otherwise unknown |
Exceptions
Type | Condition |
---|---|
Influx |
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 |
---|---|
IInflux |
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 |
---|---|
IInflux |
IInfluxDBClient.GetAuthorizationsApi()
Get the Authorization client.
Declaration
IAuthorizationsApi IInfluxDBClient.GetAuthorizationsApi()
Returns
Type | Description |
---|---|
IAuthorizations |
the new client instance for Authorization API |
IInfluxDBClient.GetBucketsApi()
Get the Bucket client.
Declaration
IBucketsApi IInfluxDBClient.GetBucketsApi()
Returns
Type | Description |
---|---|
IBuckets |
the new client instance for Bucket API |
IInfluxDBClient.GetChecksApi()
Get the Check client.
Declaration
IChecksApi IInfluxDBClient.GetChecksApi()
Returns
Type | Description |
---|---|
IChecks |
the new client instance for Checks API |
IInfluxDBClient.GetDeleteApi()
Get the Delete client.
Declaration
IDeleteApi IInfluxDBClient.GetDeleteApi()
Returns
Type | Description |
---|---|
IDelete |
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 |
---|---|---|
IDomain |
mapper | the mapper used for mapping invocation results to POCO |
Returns
Type | Description |
---|---|
IInvokable |
New instance of InvokableScriptsApi. |
IInfluxDBClient.GetLabelsApi()
Get the Label client.
Declaration
ILabelsApi IInfluxDBClient.GetLabelsApi()
Returns
Type | Description |
---|---|
ILabels |
the new client instance for Label API |
IInfluxDBClient.GetNotificationEndpointsApi()
Get the Notification
Declaration
INotificationEndpointsApi IInfluxDBClient.GetNotificationEndpointsApi()
Returns
Type | Description |
---|---|
INotification |
the new client instance for NotificationEndpoint API |
IInfluxDBClient.GetNotificationRulesApi()
Get the Notification
Declaration
INotificationRulesApi IInfluxDBClient.GetNotificationRulesApi()
Returns
Type | Description |
---|---|
INotification |
the new client instance for NotificationRules API |
IInfluxDBClient.GetOrganizationsApi()
Get the Organization client.
Declaration
IOrganizationsApi IInfluxDBClient.GetOrganizationsApi()
Returns
Type | Description |
---|---|
IOrganizations |
the new client instance for Organization API |
IInfluxDBClient.GetQueryApi(IDomainObjectMapper)
Get the Query client.
Declaration
IQueryApi IInfluxDBClient.GetQueryApi(IDomainObjectMapper mapper)
Parameters
Type | Name | Description |
---|---|---|
IDomain |
mapper | the mapper used for mapping FluxResults to POCO |
Returns
Type | Description |
---|---|
IQuery |
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 |
---|---|---|
IDomain |
mapper | the mapper used for mapping FluxResults to POCO |
Returns
Type | Description |
---|---|
IQuery |
the new synchronous client instance for the Query API |
IInfluxDBClient.GetScraperTargetsApi()
Get the Scraper
Declaration
IScraperTargetsApi IInfluxDBClient.GetScraperTargetsApi()
Returns
Type | Description |
---|---|
IScraper |
the new client instance for Scraper API |
IInfluxDBClient.GetSourcesApi()
Get the Source client.
Declaration
ISourcesApi IInfluxDBClient.GetSourcesApi()
Returns
Type | Description |
---|---|
ISources |
the new client instance for Source API |
IInfluxDBClient.GetTasksApi()
Get the Task
Declaration
ITasksApi IInfluxDBClient.GetTasksApi()
Returns
Type | Description |
---|---|
ITasks |
the new client instance for Task API |
IInfluxDBClient.GetTelegrafsApi()
Get the Telegraf client.
Declaration
ITelegrafsApi IInfluxDBClient.GetTelegrafsApi()
Returns
Type | Description |
---|---|
ITelegrafs |
the new client instance for Telegrafs API |
IInfluxDBClient.GetUsersApi()
Get the User client.
Declaration
IUsersApi IInfluxDBClient.GetUsersApi()
Returns
Type | Description |
---|---|
IUsers |
the new client instance for User API |
IInfluxDBClient.GetWriteApi(IDomainObjectMapper)
Get the Write client.
Declaration
IWriteApi IInfluxDBClient.GetWriteApi(IDomainObjectMapper mapper)
Parameters
Type | Name | Description |
---|---|---|
IDomain |
mapper | the mapper used for mapping to PointData |
Returns
Type | Description |
---|---|
IWrite |
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 |
---|---|---|
Write |
writeOptions | the configuration for a write client |
IDomain |
mapper | the converter used for mapping to PointData |
Returns
Type | Description |
---|---|
IWrite |
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 |
---|---|---|
IDomain |
mapper | the converter used for mapping to PointData |
Returns
Type | Description |
---|---|
IWrite |
the new client instance for the Write API Async without batching |