Class WriteService
Represents a collection of functions to interact with the API endpoints
Inheritance
Implements
Namespace: InfluxDB.Client.Api.Service
Assembly: InfluxDB.Client.dll
Syntax
public class WriteService : object, IWriteService, IApiAccessor
Constructors
WriteService(Configuration)
Initializes a new instance of the WriteService class using Configuration object
Declaration
public WriteService(Configuration configuration = null)
Parameters
Type | Name | Description |
---|---|---|
InfluxDB.Client.Api.Client.Configuration | configuration | An instance of Configuration |
WriteService(String)
Initializes a new instance of the WriteService class.
Declaration
public WriteService(string basePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | basePath |
Properties
Configuration
Gets or sets the configuration object
Declaration
public Configuration Configuration { get; set; }
Property Value
Type | Description |
---|---|
InfluxDB.Client.Api.Client.Configuration | An instance of the Configuration |
ExceptionFactory
Provides a factory method hook for the creation of exceptions.
Declaration
public ExceptionFactory ExceptionFactory { get; set; }
Property Value
Type | Description |
---|---|
InfluxDB.Client.Api.Client.ExceptionFactory |
Methods
AddDefaultHeader(String, String)
Add default header.
Declaration
public void AddDefaultHeader(string key, string value)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Header field name. |
System.String | value | Header field value. |
DefaultHeader()
Gets the default header.
Declaration
public IDictionary<string, string> DefaultHeader()
Returns
Type | Description |
---|---|
IDictionary<System.String, System.String> | Dictionary of HTTP header |
GetBasePath()
Gets the base path of the API client.
Declaration
public string GetBasePath()
Returns
Type | Description |
---|---|
System.String | The base path |
PostWrite(String, String, Byte[], String, String, String, Nullable<Int32>, String, String, Nullable<WritePrecision>)
Write data Writes data to a bucket. To write data into InfluxDB, you need the following: - organization name or ID – See View organizations for instructions on viewing your organization ID. - bucket – See View buckets for instructions on viewing your bucket ID. - API token – See View tokens for instructions on viewing your API token. - InfluxDB URL – See InfluxDB URLs. - data in line protocol format. InfluxDB Cloud enforces rate and size limits different from InfluxDB OSS. For details, see Responses. For more information and examples, see the following: - Write data with the InfluxDB API. - Optimize writes to InfluxDB.
Declaration
public void PostWrite(string org, string bucket, byte[] body, string zapTraceSpan = null, string contentEncoding = null, string contentType = null, int? contentLength = null, string accept = null, string orgID = null, WritePrecision? precision = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | org | The parameter value specifies the destination organization for writes. The database writes all points in the batch to this organization. If you provide both |
System.String | bucket | The destination bucket for writes. |
System.Byte[] | body | Data in line protocol format. |
System.String | zapTraceSpan | OpenTracing span context (optional) |
System.String | contentEncoding | The value tells InfluxDB what compression is applied to the line protocol in the request payload. To make an API request with a GZIP payload, send |
System.String | contentType | The header value indicates the format of the data in the request body. (optional, default to text/plain; charset=utf-8) |
System.Nullable<System.Int32> | contentLength | The header value indicates the size of the entity-body, in bytes, sent to the database. If the length is greater than the database's |
System.String | accept | The header value specifies the response format. (optional, default to application/json) |
System.String | orgID | The parameter value specifies the ID of the destination organization for writes. If both |
System.Nullable<WritePrecision> | precision | The precision for the unix timestamps within the body line-protocol. (optional) |
Exceptions
Type | Condition |
---|---|
InfluxDB.Client.Api.Client.ApiException | Thrown when fails to make API call |
PostWriteAsync(String, String, Byte[], String, String, String, Nullable<Int32>, String, String, Nullable<WritePrecision>, CancellationToken)
Write data Writes data to a bucket. To write data into InfluxDB, you need the following: - organization name or ID – See View organizations for instructions on viewing your organization ID. - bucket – See View buckets for instructions on viewing your bucket ID. - API token – See View tokens for instructions on viewing your API token. - InfluxDB URL – See InfluxDB URLs. - data in line protocol format. InfluxDB Cloud enforces rate and size limits different from InfluxDB OSS. For details, see Responses. For more information and examples, see the following: - Write data with the InfluxDB API. - Optimize writes to InfluxDB.
Declaration
public System.Threading.Tasks.Task PostWriteAsync(string org, string bucket, byte[] body, string zapTraceSpan = null, string contentEncoding = null, string contentType = null, int? contentLength = null, string accept = null, string orgID = null, WritePrecision? precision = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | org | The parameter value specifies the destination organization for writes. The database writes all points in the batch to this organization. If you provide both |
System.String | bucket | The destination bucket for writes. |
System.Byte[] | body | Data in line protocol format. |
System.String | zapTraceSpan | OpenTracing span context (optional) |
System.String | contentEncoding | The value tells InfluxDB what compression is applied to the line protocol in the request payload. To make an API request with a GZIP payload, send |
System.String | contentType | The header value indicates the format of the data in the request body. (optional, default to text/plain; charset=utf-8) |
System.Nullable<System.Int32> | contentLength | The header value indicates the size of the entity-body, in bytes, sent to the database. If the length is greater than the database's |
System.String | accept | The header value specifies the response format. (optional, default to application/json) |
System.String | orgID | The parameter value specifies the ID of the destination organization for writes. If both |
System.Nullable<WritePrecision> | precision | The precision for the unix timestamps within the body line-protocol. (optional) |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | Task of void |
Exceptions
Type | Condition |
---|---|
InfluxDB.Client.Api.Client.ApiException | Thrown when fails to make API call |
PostWriteAsyncWithHttpInfo(String, String, Byte[], String, String, String, Nullable<Int32>, String, String, Nullable<WritePrecision>, CancellationToken)
Write data Writes data to a bucket. To write data into InfluxDB, you need the following: - organization name or ID – See View organizations for instructions on viewing your organization ID. - bucket – See View buckets for instructions on viewing your bucket ID. - API token – See View tokens for instructions on viewing your API token. - InfluxDB URL – See InfluxDB URLs. - data in line protocol format. InfluxDB Cloud enforces rate and size limits different from InfluxDB OSS. For details, see Responses. For more information and examples, see the following: - Write data with the InfluxDB API. - Optimize writes to InfluxDB.
Declaration
public async System.Threading.Tasks.Task<ApiResponse<object>> PostWriteAsyncWithHttpInfo(string org, string bucket, byte[] body, string zapTraceSpan = null, string contentEncoding = null, string contentType = null, int? contentLength = null, string accept = null, string orgID = null, WritePrecision? precision = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | org | The parameter value specifies the destination organization for writes. The database writes all points in the batch to this organization. If you provide both |
System.String | bucket | The destination bucket for writes. |
System.Byte[] | body | Data in line protocol format. |
System.String | zapTraceSpan | OpenTracing span context (optional) |
System.String | contentEncoding | The value tells InfluxDB what compression is applied to the line protocol in the request payload. To make an API request with a GZIP payload, send |
System.String | contentType | The header value indicates the format of the data in the request body. (optional, default to text/plain; charset=utf-8) |
System.Nullable<System.Int32> | contentLength | The header value indicates the size of the entity-body, in bytes, sent to the database. If the length is greater than the database's |
System.String | accept | The header value specifies the response format. (optional, default to application/json) |
System.String | orgID | The parameter value specifies the ID of the destination organization for writes. If both |
System.Nullable<WritePrecision> | precision | The precision for the unix timestamps within the body line-protocol. (optional) |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<InfluxDB.Client.Api.Client.ApiResponse<System.Object>> | Task of ApiResponse |
Exceptions
Type | Condition |
---|---|
InfluxDB.Client.Api.Client.ApiException | Thrown when fails to make API call |
PostWriteAsyncWithIRestResponse(String, String, Byte[], String, String, String, Nullable<Int32>, String, String, Nullable<WritePrecision>, CancellationToken)
Write data Writes data to a bucket. To write data into InfluxDB, you need the following: - organization name or ID – See View organizations for instructions on viewing your organization ID. - bucket – See View buckets for instructions on viewing your bucket ID. - API token – See View tokens for instructions on viewing your API token. - InfluxDB URL – See InfluxDB URLs. - data in line protocol format. InfluxDB Cloud enforces rate and size limits different from InfluxDB OSS. For details, see Responses. For more information and examples, see the following: - Write data with the InfluxDB API. - Optimize writes to InfluxDB.
Declaration
public async System.Threading.Tasks.Task<RestResponse> PostWriteAsyncWithIRestResponse(string org, string bucket, byte[] body, string zapTraceSpan = null, string contentEncoding = null, string contentType = null, int? contentLength = null, string accept = null, string orgID = null, WritePrecision? precision = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | org | The parameter value specifies the destination organization for writes. The database writes all points in the batch to this organization. If you provide both |
System.String | bucket | The destination bucket for writes. |
System.Byte[] | body | Data in line protocol format. |
System.String | zapTraceSpan | OpenTracing span context (optional) |
System.String | contentEncoding | The value tells InfluxDB what compression is applied to the line protocol in the request payload. To make an API request with a GZIP payload, send |
System.String | contentType | The header value indicates the format of the data in the request body. (optional, default to text/plain; charset=utf-8) |
System.Nullable<System.Int32> | contentLength | The header value indicates the size of the entity-body, in bytes, sent to the database. If the length is greater than the database's |
System.String | accept | The header value specifies the response format. (optional, default to application/json) |
System.String | orgID | The parameter value specifies the ID of the destination organization for writes. If both |
System.Nullable<WritePrecision> | precision | The precision for the unix timestamps within the body line-protocol. (optional) |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<RestResponse> | Task of RestResponse |
Exceptions
Type | Condition |
---|---|
InfluxDB.Client.Api.Client.ApiException | Thrown when fails to make API call |
PostWriteWithHttpInfo(String, String, Byte[], String, String, String, Nullable<Int32>, String, String, Nullable<WritePrecision>)
Write data Writes data to a bucket. To write data into InfluxDB, you need the following: - organization name or ID – See View organizations for instructions on viewing your organization ID. - bucket – See View buckets for instructions on viewing your bucket ID. - API token – See View tokens for instructions on viewing your API token. - InfluxDB URL – See InfluxDB URLs. - data in line protocol format. InfluxDB Cloud enforces rate and size limits different from InfluxDB OSS. For details, see Responses. For more information and examples, see the following: - Write data with the InfluxDB API. - Optimize writes to InfluxDB.
Declaration
public ApiResponse<object> PostWriteWithHttpInfo(string org, string bucket, byte[] body, string zapTraceSpan = null, string contentEncoding = null, string contentType = null, int? contentLength = null, string accept = null, string orgID = null, WritePrecision? precision = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | org | The parameter value specifies the destination organization for writes. The database writes all points in the batch to this organization. If you provide both |
System.String | bucket | The destination bucket for writes. |
System.Byte[] | body | Data in line protocol format. |
System.String | zapTraceSpan | OpenTracing span context (optional) |
System.String | contentEncoding | The value tells InfluxDB what compression is applied to the line protocol in the request payload. To make an API request with a GZIP payload, send |
System.String | contentType | The header value indicates the format of the data in the request body. (optional, default to text/plain; charset=utf-8) |
System.Nullable<System.Int32> | contentLength | The header value indicates the size of the entity-body, in bytes, sent to the database. If the length is greater than the database's |
System.String | accept | The header value specifies the response format. (optional, default to application/json) |
System.String | orgID | The parameter value specifies the ID of the destination organization for writes. If both |
System.Nullable<WritePrecision> | precision | The precision for the unix timestamps within the body line-protocol. (optional) |
Returns
Type | Description |
---|---|
InfluxDB.Client.Api.Client.ApiResponse<System.Object> | ApiResponse of Object(void) |
Exceptions
Type | Condition |
---|---|
InfluxDB.Client.Api.Client.ApiException | Thrown when fails to make API call |
PostWriteWithIRestResponse(String, String, Byte[], String, String, String, Nullable<Int32>, String, String, Nullable<WritePrecision>)
Write data Writes data to a bucket. To write data into InfluxDB, you need the following: - organization name or ID – See View organizations for instructions on viewing your organization ID. - bucket – See View buckets for instructions on viewing your bucket ID. - API token – See View tokens for instructions on viewing your API token. - InfluxDB URL – See InfluxDB URLs. - data in line protocol format. InfluxDB Cloud enforces rate and size limits different from InfluxDB OSS. For details, see Responses. For more information and examples, see the following: - Write data with the InfluxDB API. - Optimize writes to InfluxDB.
Declaration
public RestResponse PostWriteWithIRestResponse(string org, string bucket, byte[] body, string zapTraceSpan = null, string contentEncoding = null, string contentType = null, int? contentLength = null, string accept = null, string orgID = null, WritePrecision? precision = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | org | The parameter value specifies the destination organization for writes. The database writes all points in the batch to this organization. If you provide both |
System.String | bucket | The destination bucket for writes. |
System.Byte[] | body | Data in line protocol format. |
System.String | zapTraceSpan | OpenTracing span context (optional) |
System.String | contentEncoding | The value tells InfluxDB what compression is applied to the line protocol in the request payload. To make an API request with a GZIP payload, send |
System.String | contentType | The header value indicates the format of the data in the request body. (optional, default to text/plain; charset=utf-8) |
System.Nullable<System.Int32> | contentLength | The header value indicates the size of the entity-body, in bytes, sent to the database. If the length is greater than the database's |
System.String | accept | The header value specifies the response format. (optional, default to application/json) |
System.String | orgID | The parameter value specifies the ID of the destination organization for writes. If both |
System.Nullable<WritePrecision> | precision | The precision for the unix timestamps within the body line-protocol. (optional) |
Returns
Type | Description |
---|---|
RestResponse | ApiResponse of Object(void) |
Exceptions
Type | Condition |
---|---|
InfluxDB.Client.Api.Client.ApiException | Thrown when fails to make API call |
PostWriteWithIRestResponseAsync(String, String, Byte[], String, String, String, Nullable<Int32>, String, String, Nullable<WritePrecision>, CancellationToken)
Write data Writes data to a bucket. To write data into InfluxDB, you need the following: - organization name or ID – See View organizations for instructions on viewing your organization ID. - bucket – See View buckets for instructions on viewing your bucket ID. - API token – See View tokens for instructions on viewing your API token. - InfluxDB URL – See InfluxDB URLs. - data in line protocol format. InfluxDB Cloud enforces rate and size limits different from InfluxDB OSS. For details, see Responses. For more information and examples, see the following: - Write data with the InfluxDB API. - Optimize writes to InfluxDB.
Declaration
public async System.Threading.Tasks.Task<RestResponse> PostWriteWithIRestResponseAsync(string org, string bucket, byte[] body, string zapTraceSpan = null, string contentEncoding = null, string contentType = null, int? contentLength = null, string accept = null, string orgID = null, WritePrecision? precision = null, CancellationToken cancellationToken = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | org | The parameter value specifies the destination organization for writes. The database writes all points in the batch to this organization. If you provide both |
System.String | bucket | The destination bucket for writes. |
System.Byte[] | body | Data in line protocol format. |
System.String | zapTraceSpan | OpenTracing span context (optional) |
System.String | contentEncoding | The value tells InfluxDB what compression is applied to the line protocol in the request payload. To make an API request with a GZIP payload, send |
System.String | contentType | The header value indicates the format of the data in the request body. (optional, default to text/plain; charset=utf-8) |
System.Nullable<System.Int32> | contentLength | The header value indicates the size of the entity-body, in bytes, sent to the database. If the length is greater than the database's |
System.String | accept | The header value specifies the response format. (optional, default to application/json) |
System.String | orgID | The parameter value specifies the ID of the destination organization for writes. If both |
System.Nullable<WritePrecision> | precision | The precision for the unix timestamps within the body line-protocol. (optional) |
CancellationToken | cancellationToken | Cancellation token |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<RestResponse> | ApiResponse of Object(void) |
Exceptions
Type | Condition |
---|---|
InfluxDB.Client.Api.Client.ApiException | Thrown when fails to make API call |
PostWriteWithRestRequest(String, String, Byte[], String, String, String, Nullable<Int32>, String, String, Nullable<WritePrecision>)
Write data Writes data to a bucket. To write data into InfluxDB, you need the following: - organization name or ID – See View organizations for instructions on viewing your organization ID. - bucket – See View buckets for instructions on viewing your bucket ID. - API token – See View tokens for instructions on viewing your API token. - InfluxDB URL – See InfluxDB URLs. - data in line protocol format. InfluxDB Cloud enforces rate and size limits different from InfluxDB OSS. For details, see Responses. For more information and examples, see the following: - Write data with the InfluxDB API. - Optimize writes to InfluxDB.
Declaration
public RestRequest PostWriteWithRestRequest(string org, string bucket, byte[] body, string zapTraceSpan = null, string contentEncoding = null, string contentType = null, int? contentLength = null, string accept = null, string orgID = null, WritePrecision? precision = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | org | The parameter value specifies the destination organization for writes. The database writes all points in the batch to this organization. If you provide both |
System.String | bucket | The destination bucket for writes. |
System.Byte[] | body | Data in line protocol format. |
System.String | zapTraceSpan | OpenTracing span context (optional) |
System.String | contentEncoding | The value tells InfluxDB what compression is applied to the line protocol in the request payload. To make an API request with a GZIP payload, send |
System.String | contentType | The header value indicates the format of the data in the request body. (optional, default to text/plain; charset=utf-8) |
System.Nullable<System.Int32> | contentLength | The header value indicates the size of the entity-body, in bytes, sent to the database. If the length is greater than the database's |
System.String | accept | The header value specifies the response format. (optional, default to application/json) |
System.String | orgID | The parameter value specifies the ID of the destination organization for writes. If both |
System.Nullable<WritePrecision> | precision | The precision for the unix timestamps within the body line-protocol. (optional) |
Returns
Type | Description |
---|---|
RestRequest | ApiResponse of Object(void) |
Exceptions
Type | Condition |
---|---|
InfluxDB.Client.Api.Client.ApiException | Thrown when fails to make API call |
SetBasePath(String)
Sets the base path of the API client.
Declaration
public void SetBasePath(string basePath)
Parameters
Type | Name | Description |
---|---|---|
System.String | basePath |