guilhermecfviana/powerbi-sdk

用于操作 PowerBI 的 PHP SDK

dev-master 2021-04-07 18:40 UTC

This package is auto-updated.

Last update: 2024-09-08 03:21:49 UTC


README

Build Status Codacy Badge Codacy Badge

一个使操作 PowerBI REST API 更容易的 SDK。

安装

composer require tangent-solutions/powerbi-sdk

使用方法

首先,您需要获取一个授权访问令牌。请参阅以下示例,了解如何使用 League OAuth2 Client 进行操作

$provider = new \League\OAuth2\Client\Provider\GenericProvider([
    'clientId'                => '<client-id>',
    'clientSecret'            => '<client-secret>',
    'urlAuthorize'            => 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize',
    'urlAccessToken'          => 'https://login.windows.net/<tenant-id>/oauth2/token',
    'urlResourceOwnerDetails' => '',
    'scopes'                  => 'openid',
]);

try {
    // Try to get an access token using the resource owner password credentials grant.
    $accessToken = $provider->getAccessToken('password', [
        'username' => '<Azure-Username>',
        'password' => '<Azure-Password>',
        'resource' => 'https://analysis.windows.net/powerbi/api'
    ]);

    $token = $accessToken->getToken();
} catch (\League\OAuth2\Client\Provider\Exception\IdentityProviderException $e) {
    // Failed to get the access token
    exit($e->getMessage());
}

一旦您有了访问令牌,您可以创建客户端,如下所示

$client = new \Tngnt\PBI\Client($token);

文档

Wiki

PowerBI API 参考

问题

在仓库的 问题 选项卡上查看或记录问题。

版权和许可

版权(c)Tangent Solutions。保留所有权利。在 MIT 许可 下授权。