https://github.com/satya64/powerbi-sdk-java
Java client library for MS Power BI REST APIs to provide access to Dashboards, Report, Groups, Datasets, generate embed tokens, etc.
https://github.com/satya64/powerbi-sdk-java
java microsoft powerbi rest
Last synced: 5 months ago
JSON representation
Java client library for MS Power BI REST APIs to provide access to Dashboards, Report, Groups, Datasets, generate embed tokens, etc.
- Host: GitHub
- URL: https://github.com/satya64/powerbi-sdk-java
- Owner: satya64
- License: mit
- Created: 2020-03-29T14:41:16.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-17T17:28:38.000Z (about 6 years ago)
- Last Synced: 2023-10-15T19:45:26.531Z (over 2 years ago)
- Topics: java, microsoft, powerbi, rest
- Language: Java
- Homepage:
- Size: 166 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PowerBI Java SDK
## License
[](https://github.com/satya64/powerbi-sdk-java/blob/master/LICENSE)

## Introduction
This is simple Java client(synchronous) over Microsoft PowerBI REST API using Retrofit HTTP client. It is wrapped around the common functionality available in the PowerBI REST API.
## Background
The official PowerBI page doesn't have an API for Java developers to access - . The alternative way is to use REST clients in java to access the functionality. So, that is the motivation to create this API which will enable developers to quickly and easily access the PowerBI in Java applications.
## Installation
### Maven
io.github.satya64
powerbi-sdk-java
1.0.0
### Gradle
compile group: 'io.github.satya64', name: 'powerbi-sdk-java', version: '1.0.0'
### Usage
PowerBI clients depend on authentication tokens from Azure AD for allowing access to the powerbi resources for all activities. As such it it required to know the basics of authentication flow from below links.
https://docs.microsoft.com/en-us/azure/active-directory/azuread-dev/v1-authentication-scenarios
Below will help with acquiring tokens based on the type of your application.
https://github.com/AzureAD/azure-activedirectory-library-for-java/wiki/ADAL4J-Basics
https://github.com/AzureAD/azure-activedirectory-library-for-java/wiki/Acquire-tokens
Once access token acquired, powerbi client instance can be initilized.
PowerBiClient client = PowerBiClient.getInstance(accessToken);
This will instantiate the client and that's mostly enough for us get started with operations inside the API. Below are examples how you can access different operations related to Report, Dashboard, EmbedToken, Group, etc.
1. List your reports in your organization.
client.getReportOperations().getReports(); // Returns a list of reports of user from "My Workspace"
2. List reports in a group that you have access.
client.getReportOperations().getReportsInGroup(groupId); // Returns a list of reports associated with group/workspace
< TODO > - more examples
Access tokens will have an expiry time, after which access requests will be denied. So new access toke need to be acquired and submitted to client instance.
client.updateAccessToken(newAccessToken);
This will internally update the Retrofit client configured in the API and requests can be continued using the client.
## Upcoming improvements
We have more changes to improve the API.
- Add adal4j authentication to incorporate token generation using the client itself.