Hello everyone,
I need to develop a web interface that queries our organizations/buckets in InfluxDB to provide first level information to our users. I’m developing this information in PHP 8.2 using the influxdb-client-php client.
First, I want to list my organizations and buckets in selectBoxes to create filters. No problem getting my organization list, but I can’t list the buckets. All I get in response are “system” buckets (_monitoring and _tasks).
Let’s take an example. I have an organization named ‘test’ (I know, it’s very original) which contains the buckets ‘bourges_ovins’, bourges_‘caprins’ and ‘test’ (yes, again).
I use the following code:
#[Route('/buckets', name: 'app_bucket_index')]
function index(Request $request) : Response
{
$data["controller_name"] = "BucketController";
$data["projectName"] = $_ENV["PROJECT_NAME"];
$options = InfluxClient::readInfluxDBOptionsFromProperties();
$client = InfluxClient::getInfluxDBClient($options);
$bucketService = $client->createService(BucketsService::class);
$buckets = $bucketService->getBuckets(null, null, null, null, "test", null, null, null);
$data["buckets"] = $buckets == null ? array(): $buckets["buckets"];
return $this->render('bucket/index.html.twig', $data);
}
I should get 5 buckets: _monitoring, _tasks, bourges_caprins, bourges_ovins and test as in the ‘influx bucket list’ CLI interface below.
And here’s the result I get:
I don’t understand why I can’t get my ‘user’ buckets.
I’d like to point out in advance that the token I’m using has full --read-XXX rights on all organizations.
Thanks for your help
Thierry