InfluxDB PHP Client
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
InfluxDB2\WriteApi Class Reference
Inheritance diagram for InfluxDB2\WriteApi:
InfluxDB2\DefaultApi InfluxDB2\Writer

Public Member Functions

 __construct ($options, array $writeOptions=null, array $pointSettings=null)
 
 write ($data, string $precision=null, string $bucket=null, string $org=null)
 
 writeRaw (string $data, string $precision=null, string $bucket=null, string $org=null)
 
 close ()
 
- Public Member Functions inherited from InfluxDB2\DefaultApi
 __construct (array $options)
 
 post ($payload, $uriPath, $queryParams)
 
 get ($payload, $uriPath, $queryParams)
 
 configuredClient (ClientInterface $client)
 
 createRequest (string $method, string $uriPath, string $payload, array $headers, array $queryParams)
 
 sendRequest (RequestInterface $request)
 
- Public Member Functions inherited from InfluxDB2\Writer
 write ($data)
 

Public Attributes

 $writeOptions
 
 $pointSettings
 
 $closed = false
 
- Public Attributes inherited from InfluxDB2\DefaultApi
 $options
 
 $http
 

Additional Inherited Members

- Static Public Member Functions inherited from InfluxDB2\DefaultApi
static log (string $level, string $message, array $options)
 
- Protected Member Functions inherited from InfluxDB2\DefaultApi
 check ($key, $value)
 

Constructor & Destructor Documentation

◆ __construct()

InfluxDB2\WriteApi::__construct ( $options,
array $writeOptions = null,
array $pointSettings = null )

WriteApi constructor.

Parameters
$options
array | null$writeOptions
array | null$pointSettings

Member Function Documentation

◆ write()

InfluxDB2\WriteApi::write ( $data,
string $precision = null,
string $bucket = null,
string $org = null )

Write data into specified bucket

Example write data in array $writeApi->write([ ['name' => 'cpu','tags' => ['host' => 'server_nl', 'region' => 'us'], 'fields' => ['internal' => 5, 'external' => 6], 'time' => 1422568543702900257], ['name' => 'gpu', 'fields' => ['value' => 0.9999]]], WritePrecision::NS, 'my-bucket', 'my-org' )

Example write data in line protocol $writeApi->write('h2o,location=west value=33i 15')

Example write data using Point structure $point = new Point("h2o).

Parameters
string | Point | array$dataDataPoints to write into InfluxDB. The data could be represent by array, Point, string
string | null$precisionThe precision for the unix timestamps within the body line-protocol
See also
\InfluxDB2\Model\WritePrecision
Parameters
string | null$bucketspecifies the destination bucket for writes
string | null$orgspecifies the destination organization for writes
Exceptions
ApiException

◆ writeRaw()

InfluxDB2\WriteApi::writeRaw ( string $data,
string $precision = null,
string $bucket = null,
string $org = null )

Writes data using line protocol.

Parameters
string$datapayload data as string (in line protocol format)
string | null$precisionThe precision for the unix timestamps within the body line-protocol
string | null$bucketspecifies the destination bucket for writes
string | null$orgspecifies the destination organization for writes
Exceptions
ApiException
See also
\InfluxDB2\Model\WritePrecision

The documentation for this class was generated from the following file: