public function getPowerBiDataset()

in modules/quanthub_core/src/PowerBIEmbedConfigs.php [125:151]


  public function getPowerBiDataset($token, $datasetId) {
    $powerbiAPIURL = 'https://api.powerbi.com/v1.0/myorg/groups/' . $this->getWorkspaceID() . '/datasets/' . $datasetId;

    try {
      $request = $this->httpClient->request(
        'GET',
        $powerbiAPIURL,
        [
          'headers' => [
            'Authorization' => 'Bearer ' . $token,
            'Cache-Control' => 'no-cache',
          ],
          'connect_timeout' => 30,
          'allow_redirects' => [
            'max' => 10,
          ],
        ]
      );
    }
    catch (\Exception $e) {
      $this->loggerFactory->error('getPowerBiDataset: ' . $e->getMessage());
      return NULL;
    }

    $datasetResponse = json_decode($request->getBody(), TRUE);
    return $datasetResponse;
  }