Summary : I am working on embedding Power BI reports in a ISV application and when i try to call api endpoint to get embedding details of the report it responds with 400 Bad Request . I am directly calling Power BI APIs without use of SDK as microsoft hasn't officially released PowerBI SDK for Java based application . Also , for debugging I used another .net application which uses PowerBI SDK to make the same API call against same workspace and it works without issues.
All other API endpoints like 'list all workspaces','get workspace details',' list all dashboards' in a workspace ' and even 'list all reports in workspace' respond as requested without issues, but the API endpoint listed here :
Power BI get report embedding details using 'workspace_id' and 'report_id'
responds with 400 Bad request with seemingly right credentials and request.
Interfacing Application Context :
- The ISV application is built on Spring boot framework(Java) and Angular 2 framework .
- Currently,I couldn't find official Microsoft Power BI SDK for Java based application , because of which i am directly referencing APIs from the Power BI API reference doc
- ISV application has all necessary permissions to access the APIs listed here : https://docs.microsoft.com/en-us/power-bi/developer/power-bi-permissions
- The application is able to generate token,make authenticated request and get response from power bi for all other api endpoints which are used in the application .
Issue and Debugging
Debugging :
- This is the request that PowerBI .NET SDK makes and which works against get report API :
Authorization: Bearer auth-token
User-Agent: FxVersion/4.7.2117.0 Windows_7_Enterprise/6.1.7601 Microsoft.PowerBI.Api.V2.PowerBIClient/2.0.2.17225
Host: api.powerbi.com
- This is the request that my application makes directly referencing API endpoint which returns 400 :
cache-control: no-cache
Postman-Token: some-token
Authorization: Bearer auth-token
User-Agent: PostmanRuntime/7.1.1
Accept: /
Host: api.powerbi.com
PowerBI.Api
simply wraps Http calls, you should be able to debug and capture details and then try to build the same request in Postman. If nothing helps, you can route via Fidler, to inspect differences. – Sherlock