influxdb-client-js

InfluxDB 2.0 JavaScript client

View the Project on GitHub influxdata/influxdb-client-js

Home > @influxdata/influxdb-client > InfluxDB > getWriteApi

InfluxDB.getWriteApi() method

Creates WriteApi for the supplied organization and bucket. BEWARE that returned instances must be closed in order to flush the remaining data and close already scheduled retry executions.

Signature:

getWriteApi(org: string, bucket: string, precision?: WritePrecisionType, writeOptions?: Partial<WriteOptions>): WriteApi;

Parameters

Parameter Type Description
org string Specifies the destination organization for writes. Takes either the ID or Name interchangeably.
bucket string The destination bucket for writes.
precision WritePrecisionType (Optional) Timestamp precision for line items.
writeOptions Partial<WriteOptions> (Optional) Custom write options.

Returns:

WriteApi

WriteApi instance

Remarks

Use WriteOptions to customize retry strategy options, data chunking and flushing options. See DEFAULT_WriteOptions to see the defaults.

See also write example, writeAdvanced example, and browser example.