BucketService::getBuckets() does not return all buckets for an organization (influxdb-client-php)

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

Do you want to change the logic a bit like so:
$buckets = $bucketService->getBuckets();

Try to retrieve all buckets, see if that shows you all of them and then on client side you can filter by organisation name etc.

thank you for your answer @suyash . it’s the first thing I tested

then, as I had 9 times (9 organizations) _tasks and _monitoring buckets, I filtered by organization thinking I’d get my user buckets back … … unfortunately, not !

I see, one thing I can suggest is filing a GitHub issue to request support for this in the sdk. They are generally pretty quick to respond Issues · influxdata/influxdb-client-php · GitHub